I have an access database that I created using sql in the actual program and have used a 'BIT' to make a record true or false. Now I would like to use the update sql statement to change whether my record is true or false.
For example I have a payments database table and a paid record which is either true or false.
if (HasPaidCBOX.Checked) { Cmd.CommandText = "UPDATE Payments SET Paid = @p WHERE PlayerID ='" + PaymentForm.ID + "'"; Cmd.Parameters.AddWithValue("@p", xxx); Cmd.ExecuteNonQuery(); }
I would like to know what goes in the place marked with three x's.
Access uses -1 for TRUE and 0 for FALSE. So use 0 and -1.
-1
0
Also, as pointet out by @ADyson you should parameterise all values in your SQL statements.
1.4m articles
1.4m replys
5 comments
56.9k users