html - Connecting to database and reading data in asp.net -


what doing wrong here? error:

incorrect syntax near =

on line of code:

dim sqldatareader sqlclient.sqldatareader = sqlcommad.executereader() 

my code:

dim username = tusername.text dim password = tpassword.text  dim sqlconnection = new sqlclient.sqlconnection(my.settings.dbconnection.tostring) dim sqlcommand = new sqlclient.sqlcommand("select * " + my.settings.tablename.tostring + "where empid = " + username, sqlconnection) sqlconnection.open()  dim sqldatareader sqlclient.sqldatareader = sqlcommand.executereader  while (sqldatareader.read)       if username = sqldatareader(1).tostring , password = sqldatareader(20).tostring          if eencrypt(username, password)             msgbox("you not logged in")          else             msgbox("you logged in")          end if       end if end while  sqlconnection.close() 

this should work, see how parammeter added

dim username = tusername.text dim password = tpassword.text  dim sqlconnection = new sqlclient.sqlconnection(my.settings.dbconnection.tostring) dim sqlcommand = new sqlclient.sqlcommand("select * " + my.settings.tablename.tostring + "where empid = @username", sqlconnection)  sqlcommand.parameters.addwithvalue("@username", username) sqlconnection.open()  dim sqldatareader sqlclient.sqldatareader = sqlcommand.executereader()  while (sqldatareader.read)       if username = sqldatareader(1).tostring , password = sqldatareader(20).tostring          if eencrypt(username, password)             msgbox("you not logged in")          else             msgbox("you logged in")          end if       end if end while  sqlconnection.close() 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -