I have a table in mysql databse with a boolean column (or tinyint(1)). In my web application i used a gridview to view the data from that table and I used a checkbox field for the boolean column. Everything’s ok till here. When I try to update a record, checking or unchecking the checkbox field using this query for the update:
UPDATE image SET `desc` = @desc, `ss` = @ss WHERE `id` = @id
the result is always the same: the desc field is correctly updated meanwhile the ss (boolean field) is always set to 0, even if maybe i set it to 1 or true. Any idea on how to do it? I paste the sqldatasource code below:
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:dogservConnectionString %>"
DeleteCommand="DELETE FROM image WHERE `id` = @id"
ProviderName="<%$ ConnectionStrings:dogservConnectionString.ProviderName %>"
SelectCommand="SELECT * FROM image"
UpdateCommand="UPDATE image SET `desc` = @desc, `ss` = @ss WHERE `id` = @id">
<DeleteParameters>
<asp:Parameter Name="id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="desc" Type="String" />
<asp:Parameter Name="path" Type="String" />
<asp:Parameter Name="name" Type="String" />
<asp:Parameter Name="ss" Type="Object" />
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
I can’t help you with asp.net, but that looks very suspicious to me.
You tell us that your ss column is a tinyint so type should be something like Int32 or bool.