I second what Cowboy said, but also, you should use parameterized queries,
so your update statement should look like:
command.commandText = "Update Table set fieldName = @Value"
command.Parameters.Add("@Value", SqlDbType.Bit).Value = checkbox.selected
this will (a) help protect against SQL Injection (b) make it easier for you
to move to sprocs (if you decide to do so).
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/index.aspx - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"bijoy" <b_*****@yahoo.ca> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
I am in the process of upgrading my application db from Access to SQL
Server.
With the Access backend, I had queries such as "UPDATE table SET
fieldName = True". SQL Server doesnt seem to like TRUE as a bool value,
instead it requires 0 and 1.
My queries are based on user input, so if a checkbox is checked, I
create my query as follows:
"UPDATE table SET fieldName = " + checkbox.selected
which translates to
"UPDATE table SET fieldName = True"
Do I have to rewrite all my queries to conver the "True" to 0/1? Or is
there an easier way?
Bijoy