如何在c#winform中的数据库中存储和检索chekbox值 [英] how to store and retrive chekbox values in databse in c# winform
本文介绍了如何在c#winform中的数据库中存储和检索chekbox值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在数据库中以c#winform存储和检索chekbox值...
i wana存储和检索chekbox和chek列表框的值..plz指导我
解决方案
如果您的DBMS是SQL服务器,您必须显示具有位数据类型的布尔值。此数据类型取两个值:
1- 0表示错误
2- 1表示真的
当你将应用程序绑定到sql时它会自动执行所有操作。
祝你好运
嗨
这将有力地帮助你..
去扔这个链接..
http://stackoverflow.com/questions / 14092494 / retrieve-checkboxlist-value-in-c-net [ ^ ]
乐于助人
if(checkBox1.checked == true)
{
string value = 你的价值;
}
sqlcommand cmd = new sqlcommand(INSERT INTO yourtable(column-name)VALUE('+ value +'),con);
cmd.executeNonQuery();
i显示使用连接的ua代码片段,但更好的方法是传递参数。
希望这会帮助你
如果任何问题请问。
问候
bunzitop
how to store and retrive chekbox values in databse in c# winform...
i wana to store and retrive values of chekbox and chek list box ..plz guide me
解决方案
Hi if your DBMS is SQL server, you must display boolean value with Bit Data Type.this Data Type take two value:
1- 0 means false
2- 1 mean true
when you bind your application to sql it automatically do all thing.
good luck
Hi
this will defiantly help you..
go throw this link..
http://stackoverflow.com/questions/14092494/retrieve-checkboxlist-value-in-c-net[^]
Happy to help
you can try this, hope it will meet your requirement
if(checkBox1.checked == true) { string value = "your Value"; } sqlcommand cmd = new sqlcommand("INSERT INTO yourtable (column-name) VALUE ('"+ value +"'), con); cmd.executeNonQuery();
i showed u a code snippet using concatenation,but its better idea to pass parameter.
hope this will help you
if any question plz ask.
regards
bunzitop
这篇关于如何在c#winform中的数据库中存储和检索chekbox值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文