Hi,
I am having a problem with updating the database from the dataset.My code executes fine and comes out of the procedure but i cannot see the changes in the database.Can anyone tell me where I am going wrong.
Here is my code:
Dim custDA As OleDbDataAdapter = New OleDbDataAdapter()
Dim custDS As DataSet = New DataSet()
Dim adoConn As ADODB.Connection = New ADODB.Connection()
Dim adoRS As ADODB.Recordset = New ADODB.Recordset()
Dim dte As DateTime
dte = dte.Now
Dim aryFields() As String = Split("Type,GUID,IsRunning,LastRun,Interval", ","
Dim aryValues() As String = Split("DataFeed,hello,False,02/20/2003,1000", ","
adoConn.Open("PROVIDER=MICROSOFT.JET.OLEDB.4.0;Data Source=c:\myDig\DigDemo.mdb;"
adoRS.Open("SELECT * FROM Scheduler", adoConn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, 1)
custDA.Fill(custDS, adoRS, "Scheduler"
MessageBox.Show("OK"
Dim drCurrent As DataRow
drCurrent = custDS.Tables("Scheduler".NewRow()
drCurrent.Item("Type" = "DataFeed"
drCurrent.Item("GUID" = "hello"
drCurrent.Item("IsRunning" = False
drCurrent.Item("LastRun" = dte
drCurrent.Item("Interval" = 1000
'drCurrent.AcceptChanges()
custDS.Tables("scheduler".Rows.Add(drCurrent)
custDS.AcceptChanges()
custDA.Update(custDS, "Scheduler"
'MessageBox.Show(custDA.InsertCommand().CommandText().ToString())
MessageBox.Show("Done"
adoConn.Close()
I am having a problem with updating the database from the dataset.My code executes fine and comes out of the procedure but i cannot see the changes in the database.Can anyone tell me where I am going wrong.
Here is my code:
Dim custDA As OleDbDataAdapter = New OleDbDataAdapter()
Dim custDS As DataSet = New DataSet()
Dim adoConn As ADODB.Connection = New ADODB.Connection()
Dim adoRS As ADODB.Recordset = New ADODB.Recordset()
Dim dte As DateTime
dte = dte.Now
Dim aryFields() As String = Split("Type,GUID,IsRunning,LastRun,Interval", ","
Dim aryValues() As String = Split("DataFeed,hello,False,02/20/2003,1000", ","
adoConn.Open("PROVIDER=MICROSOFT.JET.OLEDB.4.0;Data Source=c:\myDig\DigDemo.mdb;"
adoRS.Open("SELECT * FROM Scheduler", adoConn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockBatchOptimistic, 1)
custDA.Fill(custDS, adoRS, "Scheduler"
MessageBox.Show("OK"
Dim drCurrent As DataRow
drCurrent = custDS.Tables("Scheduler".NewRow()
drCurrent.Item("Type" = "DataFeed"
drCurrent.Item("GUID" = "hello"
drCurrent.Item("IsRunning" = False
drCurrent.Item("LastRun" = dte
drCurrent.Item("Interval" = 1000
'drCurrent.AcceptChanges()
custDS.Tables("scheduler".Rows.Add(drCurrent)
custDS.AcceptChanges()
custDA.Update(custDS, "Scheduler"
'MessageBox.Show(custDA.InsertCommand().CommandText().ToString())
MessageBox.Show("Done"
adoConn.Close()