DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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


Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links