Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

Incorrect syntax in sqlcommand

$
0
0
I'm coming from working with just ms access to try to learn to do the same things in sql. I'm getting an error that says:

Quote:

incorrect error at syntax '?'
The command string that I'm using is:
Code:

Dim cmd As New SqlCommand("SELECT username,password FROM login WHERE username = ? AND password = ?", con)
cmd.Parameters.AddWithValue("username", UsernameTextBox.Text)
cmd.Parameters.AddWithValue("password", PasswordTextBox.Text)

and that's how I would do it with the OleDbCommand. Could somebody shed some light for me?

Also the way I created the SQL database was:
  1. Add New DataSource
  2. Database -> Next
  3. Dataset -> Next
  4. New Connection
  5. Change DataSource -> MS SQL Database File -> Ok
  6. Name database -> OK

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>