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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

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


Date: Tue, 3 Aug 2004 21:46:50 +0800

The more information given by system is :
"Unhandled"System.Data.OleDb.OleException" exception rised in
system.data.dll"

Is there any better menthod to insert a data record into an access database
table?

"Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard.caspershouse.com> дÈëÓʼþ
news:e8cGBlVeEHA.2812@tk2msftngp13.phx.gbl...
> authorking,
>
> Does it give any more information than that in the exception? There
> should be more information than that in the exception message and the call
> stack (for example, it was a COM error code that was returned, what is
> that?).
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@spam.guard.caspershouse.com
>
> "authorking" <authorking2002@hotmail.com> wrote in message
> news:e9zWGSVeEHA.712@TK2MSFTNGP09.phx.gbl...
> > 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

  • Re: Security exception while opening an OleDBConnection
    ... CyberLotus have you given it the right permissions? ... and i posted a similar solution for MS access database. ... Security Exception. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • How do I track down this error??? A first chance exception of type System.Runtime.InteropServices.C
    ... Back once again with a problem that prohibits me from adding records to an Access database. ... I get this error "A first chance exception of type 'System.Runtime.InteropServices.COMException' ... but I don't know how to access HRESULT. ... Private Sub BI_Process ...
    (microsoft.public.dotnet.languages.vb)
  • Syntax error with Access database
    ... Changes can be made to the dataset text boxes with no problems but I get a syntax error attempting to update or insert into a Access database. ... bLoading = True dsGRAD.GRADUATE.CleardaGRAD.Fill ... The syntax error generated is identical to the error message mentioned in the message from Dustin Wilson dated 12 Aug 2005 to this group with the exception of the different names and locations of the database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: insert a data record into a data table of a access database(mdb)
    ... > Is there any better menthod to insert a data record into an access database> table? ... >> authorking, ... >> Does it give any more information than that in the exception? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Structured exception information
    ... Doesn't feel as type-safe as advertised. ... What, _exactly_, will the handler do with the separate bits? ... Looking up the localized error message in the dictionary based on the *type-safe* error code that it got from the exception object, ... I'm looking forward to see a convincing solution for error code and the dictionary. ...
    (comp.lang.ada)