troubleshooting Question

How do I use tableAdapter to save back into Table in Access DB (using vb.net 2005)

Avatar of Jeanette Durham
Jeanette DurhamFlag for United States of America asked on
Visual Basic.NET
10 Comments1 Solution392 ViewsLast Modified:
I have a routine which opens a connection to a csv file, and then reads it into a dataset. Next I want to save the dataset back to the db. Altho the following code is not producing an error, and /is/ filling the dataset, it is /not/ saving back into the db.

What am I doing wrong?

Thanks Experts~Michael

  Public Sub LoadCSVIntoDataTable(ByVal csvPath$, ByVal tableName$)
        myOleDBConnection = New OleDb.OleDbConnection(My.Settings.myConnectionString)      ' Setup connection
        myOleDBConnection.Open()
        myDB.doQueryCmdUsingConnection("Delete * From AffInfo;")
        Stop
        '
        Dim conn As System.Data.Odbc.OdbcConnection
        Dim strConnstr$ = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + csvPath + ";"
        conn = New Odbc.OdbcConnection(strConnstr)

        Dim da As New System.Data.Odbc.OdbcDataAdapter("Select * From AffInfo_Update.csv", strConnstr)
        da.Fill(myDS, "AffInfo")
        'myOLEDBAdapter.Fill(myDS, "Output")

        'myfuncs.debugPrintDataTable(myDS.Tables("CSV"))

        da.Update(myDS, "AffInfo")
        myDB.CloseOleDBConnection()
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros