Forum Moderators: mack

Message Too Old, No Replies

Update Data source using dataset

         

edwinxp

9:29 am on May 5, 2004 (gmt 0)

10+ Year Member



Hi all,

At first I have an Access table which is empty. Then I programmatically populate a dataset with values. I need to update these values from dataset to datasource.
But after the update command the datasource is still empty.

Can anyone please help me out?

Thanks in advance,
Ed

Krapulator

11:51 pm on May 5, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Ed,

Post the code you are using to update the access table.

edwinxp

4:35 am on May 6, 2004 (gmt 0)

10+ Year Member



Hi,

Here is the code:

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strDBPath
conn = New OleDbConnection(strConn) conn.Open()

daFileInfo = New OleDbDataAdapter(New OleDbCommand("SELECT ID,fname,fpath,fsize,fmodified FROM VerInfo", conn))

daFileInfo.InsertCommand = New OleDbCommand("INSERT INTO VerInfo(ID,fname,fpath,fsize,fmodified) VALUES (?,?,?,?,?)", conn)

cb = New OleDbCommandBuilder(daFileInfo)

daFileInfo.FillSchema(dsFileInfo, SchemaType.Source)
daFileInfo.Fill(dsFileInfo)

Dim myDataRowArray() As DataRow = dsFileInfo.Tables(0).Select(Nothing, Nothing, DataViewRowState.Added)

daFileInfo.Update(myDataRowArray)

' daFileInfo.Update(dsFileInfo, "edVerInfo")

Hoping to get a solution soon...

Thank you