4
Answers

simple issue ? Windows forms ..

Ask a question
SUNIL GUTTA

SUNIL GUTTA

10y
866
1
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)