Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
how can we Load Radio Button Value Into Database
can any one help with sql query....

i used this one code..but not working
string sql = " UPDATE resperson SET kfri = '" + rb1.Checked +"' WHERE resid = '" + tbrid.Text + " ' ";
Posted
Updated 8-Jun-11 19:39pm
v3
Comments
walterhevedeich 9-Jun-11 1:36am    
Post your code so we can have a better understanding on your problem.
Ragi Gopi 9-Jun-11 1:39am    
improved question
Prerak Patel 9-Jun-11 1:59am    
What error do you get? Specify datatypes of kfri and resid too.
Ragi Gopi 9-Jun-11 2:04am    
datatype of kfri is Yes/No...and resid is autonumber..
and error is data mismatch..this happens because...rb1.checked returns the value..true or false..
RakeshMeena 9-Jun-11 2:04am    
If you are down voting, put the reason as well.... This is not good as you are asking for help not doing favor to anybody.

1 solution

What is the datatype of "kfri" column? If it's varchar type you should not have any problem. Also if you can post the value of "sql" string post the line of code (you posted).
 
Share this answer
 
Comments
Ragi Gopi 9-Jun-11 2:02am    
'datatype of kfri is Yes/No...
RakeshMeena 9-Jun-11 2:08am    
I don't think there is a "Yes/No" datatype in Sql Server. It must be a bit, for that you need to modify your code to something like this: string sql = " UPDATE resperson SET kfri = '" + (rb1.Checked)?1:0 +"' WHERE resid = '" + tbrid.Text + " ' ";
Ragi Gopi 9-Jun-11 2:07am    
sorry......... down voting was a mistake..
RakeshMeena 9-Jun-11 2:09am    
Not a problem but you should make up for that.....
Anyways try the above piece of code and let me know if it works.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900