SUNIL GUTTA

SUNIL GUTTA

  • NA
  • 1k
  • 392.8k

simple issue ? Windows forms ..

Feb 14 2014 12:31 PM
Hi
 
When i am trying like this :
 
cmd.CommandText = "select LastName,FirstName,EmailAddress,MobilePhone from contactdetails where LastName = 'gutta' ";  my code executing perfect when i am giving static data like gutta ...
 
BUT 
 
I am getting no error ..  .. ..
 
when i am trying like this ..
cmd.CommandText = "select LastName,FirstName,EmailAddress,MobilePhone from contactdetails where LastName = " + textBox1.Text ; 
 
ERROR IS :
dr = cmd.ExecuteReader();  ------------------> 
Invalid column name 'gutta'.
 
Regards 

Answers (4)