OleDB exception on .Update


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: OleDB exception on .Update

  1. #1
    Miroslav St. Jeliaskoff Guest

    OleDB exception on .Update

    Hello!

    I'm having a problem ...

    "An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"

    .... on the last row of this code. Can anybody tell why? No additional information is given from the VB.NET. I'm using a MDB file created from scrach in Access XP. I have a field in the table "Tests" which is AutoNumber and don't try to write in it :-) I'm able to read from the table at the same time.

    Dim rsltConnection As OleDb.OleDbConnection
    Dim rsltAdapter As OleDb.OleDbDataAdapter
    Dim rsltDataset As DataSet
    Dim rsltRow As DataRow
    Dim sqlSELECT As String = " SELECT * FROM Tests;"
    rsltConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
    strFile & ";Mode=ReadWrite;")

    rsltAdapter = New OleDb.OleDbDataAdapter(sqlSELECT, rsltConnection)
    Dim autogen As New OleDb.OleDbCommandBuilder(rsltAdapter)

    rsltDataset = New DataSet()
    rsltAdapter.Fill(rsltDataset, "Tests")
    rsltRow = rsltDataset.Tables("Tests").NewRow 'adding new row

    rsltRow("Date") = Now
    rsltRow("UserName") = "USER"

    rsltDataset.Tables("Tests").Rows.Add(rsltRow)

    rsltAdapter.Update(rsltDataset, "Tests") 'it stops here


    Don't know what to do. Any ideas where it comes from?

    Please help!
    Miroslav St. Jeliaskoff


  2. #2
    Miroslav St. Jeliaskoff Guest

    Re: OleDB exception on .Update

    The creator of the DB table named one of the fields "Date" and I wasn't so bright to see it on first look. And second look - actually atleast for an hour.

    Sorry, guys
    Thanks!
    "Miroslav St. Jeliaskoff" <miroslav@earthling.net> wrote in message news:3d822ec8@10.1.10.29...
    Hello!

    I'm having a problem ...

    "An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"

    ... on the last row of this code. Can anybody tell why? No additional information is given from the VB.NET. I'm using a MDB file created from scrach in Access XP. I have a field in the table "Tests" which is AutoNumber and don't try to write in it :-) I'm able to read from the table at the same time.

    Dim rsltConnection As OleDb.OleDbConnection
    Dim rsltAdapter As OleDb.OleDbDataAdapter
    Dim rsltDataset As DataSet
    Dim rsltRow As DataRow
    Dim sqlSELECT As String = " SELECT * FROM Tests;"
    rsltConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
    strFile & ";Mode=ReadWrite;")

    rsltAdapter = New OleDb.OleDbDataAdapter(sqlSELECT, rsltConnection)
    Dim autogen As New OleDb.OleDbCommandBuilder(rsltAdapter)

    rsltDataset = New DataSet()
    rsltAdapter.Fill(rsltDataset, "Tests")
    rsltRow = rsltDataset.Tables("Tests").NewRow 'adding new row

    rsltRow("Date") = Now
    rsltRow("UserName") = "USER"

    rsltDataset.Tables("Tests").Rows.Add(rsltRow)

    rsltAdapter.Update(rsltDataset, "Tests") 'it stops here


    Don't know what to do. Any ideas where it comes from?

    Please help!
    Miroslav St. Jeliaskoff


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center