hi can u guys help me find what is my error in my line.

 cmd.CommandText = "SELECT * FROM TblLogin where Username='"+ usr_lgn.Text +"'and Password = '" + pswr_lgn.Text + "'where STAFFSTATUS="+"ACTIVE"+"";

im having an error saying incorrect syntax near the word where.
thank u

Shouldn't ACTIVE be surrounded by single quotes? Another issue might be the lack of a space before the WHERE

@pritaeas
ok w8 lemme try , ty
edit: still no luck

  cmd.CommandText = "SELECT * FROM TblLogin where Username='"+ usr_lgn.Text +"'and Password = '" + pswr_lgn.Text + "' where STAFFSTATUS='"+"'ACTIVE'"+"'";

Edited 2 Years Ago by kidkardel: edit

A little modification is needed in your SQL statement. It should be the following.

  cmd.CommandText = "SELECT * FROM TblLogin where Username='"+ usr_lgn.Text +"' and Password ='" + pswr_lgn.Text + "' and STAFFSTATUS ='ACTIVE'";

@shark_1
never mind THANK YOU!

Edited 2 Years Ago by kidkardel: eyes

cmd.CommandText = string.Format("SELECT * FROM TblLogin WHERE Username='{0}' AND Password = '{1}' AND STAFFSTATUS = '{2}'", usr_lgn.Text, pswr_lgn.Text, "ACTIVE");

Edited 2 Years Ago by pritaeas: Added markdown.

This question has already been answered. Start a new discussion instead.