BobtheCat1er
BobtheCat1er

Reputation: 45

Sql query unable to parse query text

I have tried creating a SQL query in vb and i keep getting an error. Here is my code:

SELECT userid, Email, [password], [First Name]
     , [Last Name], [Date of Birth], Major
FROM   Students
WHERE  userid = @StudentIdParam AND [password] = @studentPassParam

And the error is as follows:

error in WHERE clause near '@' unable to parse query text.

Any help will be greatly appreciated.

Upvotes: 1

Views: 2626

Answers (1)

davmos
davmos

Reputation: 9577

cmd.Parameters.Add("@StudentIdParam", studentIdParam)
cmd.Parameters.Add("@studentPassParam", studentPassParam)

...before executing the query.

Upvotes: 1

Related Questions