Convert bool to SqlBoolean

J

Julius Fenata

Dear all,

How to convert bool to SqlBoolean? I need to parse CheckBox.Checked value to
SQL Server table...

My code is..,

string myString = "INSERT INTO tblCoba(Coba) VALUES('" +
SqlBoolean.Parse(CheckBox1.Checked) + "')";

But it isn't working, how to do that?

Thanks,
Julius F
 
M

Michael Tkachev

string myString = "INSERT INTO tblCoba(Coba) VALUES("
+(CheckBox1.Checked)?1:0+")";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top