1
Answer

update ms access check box column

anji marothu

anji marothu

11y
1.1k
1
hi all.. in my ms access database am using check box column.

there is a no problem when inserting the row in the database.

but when am updating the check box column. it will show "datatype mismatch".

how can i handle this.....

here is my code...................

  internal void updatestbInfo(string stbnumber, string stbname, int price, string purchasedate, string description, bool isactive)
       {
           cn.Close();
           cn.Open();
           cmd = null;
           cmd = new OleDbCommand("update STBINFO set  stbno=@stbno,stbname=@stbname,price=@price,purchasedate=@purchasedate,description=@description,isactive=@isactive where stbno=@stbno", cn);
           cmd.Parameters.AddWithValue("@stbno", stbnumber);
           cmd.Parameters.AddWithValue("@stbname", stbname);
           cmd.Parameters.AddWithValue("@price", price);
           cmd.Parameters.AddWithValue("@purchasedate", purchasedate);
           cmd.Parameters.AddWithValue("@isactive", isactive);
           cmd.Parameters.AddWithValue("@description", description);
           cmd.ExecuteNonQuery();
           MessageBox.Show(isactive.ToString());
           cn.Close();
       }


here @isactive is a checkbox column....



Answers (1)