When i try to log in i keep getting this error and i dont have a clue what it means
the code i used is below along with the error message:

code - Dim dr As OleDbDataReader = cmd.ExecuteReader
error - Syntax error in FROM clause

Member Avatar for DearDhruv

Dear Friend,

U r matching only one time with datareader..
see datareader has one property that "it is read data row wise and one by one"...

so try while loop...
put condition like as follow
:)

While dr.Read = True

some code()

End While
:)


and obviously there is mistake in

:( from clause:( .....

I think this will help u...

>error - Syntax error in FROM clause

Please check the syntax of select statement.

...
  Dim cn as New OledbConnection("your connection string")
  Dim cmd as new OledbCommand("select [username] from LoginTable where [username]=@para1 and [password]=@para2",cn)

  cmd.Parameters.AddWithValue("@para1",TextBox1.Text)
  cmd.Parameters.AddWithValue("@para2",TextBox2.Text)
 
   cn.Open()
   Dim dr as OleDBDatareader = cmd.ExecuteReader()
   if dr.Read() Then
           'Login success
   Else
          'Login fails
   End If
   dr.Close()
   cn.Close()
....
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.