1

I have an error running this statement in vb.net.The following error ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Request.GodownFROM Request WHERE (((Request.Rdate)=#03/27/2017#) AND ((Request.Godown)='Indian''.

sql = "SELECT Request.[Rdate], Request.[Item Name], Request.[Category], Request.[Unit], Request.[Quantity], Request.[Rate], Request.[Amount], Request.[Godown]" _
          & "FROM Request WHERE Request.[Rdate]=#" & dtrdate.Value & "# AND Request.[Godown]='" & lblgodown.Text & "'"

    Dim da As New System.Data.Odbc.OdbcDataAdapter(sql, con)

    da.Fill(dt)
    dgtvgo1.DataSource = dt
1
  • You should use prepared statements to avoid SQL injection. Commented Mar 27, 2017 at 5:43

1 Answer 1

2

You need a space before the "[from...]". So change the second line to " [from..."

Sign up to request clarification or add additional context in comments.

3 Comments

Hi Dave, if you feel the question is wrong only in having a small typo, then vote to close the question rather than answering it.
Thanks, I know this will be a small mistake somewhere. I have encounter the same problem before and solved it the same way. But somehow I missed this time.
Tim - seroiously? Close the question rather than helping the person with an answer? I will never understand the protocol on this site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.