I am getting the following error when I run my code:
Incorrect syntax near the keyword 'User'.
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
This is my code:
If k = 1 And b = 1 And c = 1 And d = 1 And f = 1 And g = 1 And h = 1 Then
Dim connection As SqlConnection = New SqlConnection()
connection.ConnectionString = "Data Source=DESKTOP-9G2397U;Initial Catalog=shopping;Integrated Security=True"
connection.Open()
Dim da As SqlDataAdapter = New SqlDataAdapter
Dim ds As DataSet = New DataSet()
Dim sql As String
sql = ("select * from User where username='" & txt_username.Text & "'")
da = New SqlDataAdapter(sql, connection)
da.Fill(ds, "User")
If ds.Tables("User").Rows.Count = 1 Then
MessageBox.Show("This Username Already Exists, Re-enter A New One", "Username Already Exists")
What does this error mean and how can I fix it?