insert a data record into a data table of a access database(mdb)

From: authorking (authorking2002_at_hotmail.com)
Date: 08/03/04


Date: Tue, 3 Aug 2004 20:22:17 +0800

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.



Relevant Pages

  • [Full-Disclosure] Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit ... Connection closed by foreign host. ... think what we want to execute. ...
    (Full-Disclosure)
  • Advanced usage of system() function.
    ... and call its arguments as a command for shell. ... as we can see we still didnt get what we want (typing exit we are ... Connection closed by foreign host. ... think what we want to execute. ...
    (Bugtraq)
  • Re: Wait for background processes to complete
    ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
    (comp.lang.perl.misc)
  • Mischel round the newcomer
    ... execute Ralph's barrel with phases, ... complaining beneath the passing area. ... Fucking don't rise less while you're predicting ... sweet catholic interviews. ...
    (sci.crypt)
  • Execute Process Task not failing, but not executing the batch comm
    ... I can execute the following command from the windows "Run" prompt and it ... Might I have something set weird in SQL Server? ... server being by default configured to run as localsystem account, ...
    (microsoft.public.sqlserver.dts)