PDA

View Full Version : Check box insertion in Access DB


ahussain
09-07-2007, 10:35 PM
Hi,

Can any one tell me that how can I insert/update check box into access yes/no field. I tried to update in this way....

//Gettin' value in o or 1
byte result = convert.ToByte(chk1.checked)

com = new OleDbCommand(String.Format(@"Update Table SET
firstname= '{0}',
LastName ='{1}',
status = {2}
Where ID = {3}",
txtName.Text,txtLast.Text,result,ID),con)


Does any one where exactly the problem is . the compiler says
cant index or zero based argument.....

Single word will be appreciated.

SouthwaterDave
09-08-2007, 08:26 PM
Updating an Access database from a potentially multi-user, multi-concurrent IIS/ASP.Net application can cause all sorts of problems so I strongly advise you to move to a SQL Server, SQL Server Express or MySQL database if that's practical.

However, I think the answer to your immediate problem, if my memory serves me correctly, is that you have to translate the check box value to "Yes" or "No" for the SQL.