A
authorking
I use the following code to insert a data record in to a datatable of an
access database.But every time I execute the command, there will rise an
exception and the insert operation can't be completed.
here's the code:
System.Data.OleDb.OleDbConnection hist_cnn = new
System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand hist_command = new
System.Data.OleDb.OleDbCommand();
System.Data.DataSet hist_data = new System.Data.DataSet();
hist_command.CommandText="insert into hist_data_record
(record_id) values('2003') ";
hist_cnn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=history_data.mdb;" + "Jet OLEDB:Engine Type=5";
hist_cnn.Open();
hist_command.Connection=hist_cnn;
hist_command.ExecuteNonQuery();//rise a exception and the
operation ended
I want to know where the problems is.
access database.But every time I execute the command, there will rise an
exception and the insert operation can't be completed.
here's the code:
System.Data.OleDb.OleDbConnection hist_cnn = new
System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand hist_command = new
System.Data.OleDb.OleDbCommand();
System.Data.DataSet hist_data = new System.Data.DataSet();
hist_command.CommandText="insert into hist_data_record
(record_id) values('2003') ";
hist_cnn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;"
+ "Data Source=history_data.mdb;" + "Jet OLEDB:Engine Type=5";
hist_cnn.Open();
hist_command.Connection=hist_cnn;
hist_command.ExecuteNonQuery();//rise a exception and the
operation ended
I want to know where the problems is.