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

VulpesPosted Feb 14, 2014, 12:57 PM
SUNIL GUTTAPosted Feb 14, 2014, 1:51 PM
VulpesPosted Feb 14, 2014, 1:28 PM
Only strings and dates need quotes. Numbers don't.
SUNIL GUTTAPosted Feb 14, 2014, 1:11 PM
Ty so much your help Helps :)
I feel confused sometimes .. The same thing i used somewhere in cascading dropdownlists its working fine but here in the above senario its popping me error ..
MY LAST senario which didnt give me any sort of error is
cmd.CommandText = "select state,stateid from countrystate where countryid=" + DropDownList1.SelectedValue;
Any ideas y :)