Hi,
I am trying to create an offline database in VB.NET 2005, both the online and offline database use SQL Server 2005.
The code I am using seems to run OK with out an exception the DATASET has the records added, but the UPDATE will not update the offline database. (The offline database is empty before I start)
Q1) what am I doing wrong?
Q2) is there a better way of coping data to an offline SQL database?
My code
Thanks
Eric
I am trying to create an offline database in VB.NET 2005, both the online and offline database use SQL Server 2005.
The code I am using seems to run OK with out an exception the DATASET has the records added, but the UPDATE will not update the offline database. (The offline database is empty before I start)
Q1) what am I doing wrong?
Q2) is there a better way of coping data to an offline SQL database?
My code
Code:
Try
da = New SqlDataAdapter(SQLcmd)
conSQL.Open()
da.Fill(dsOffLine, "TableName")
dtOffLine= dsOffLine.Tables(0)
Dim dsRow As DataRow
Dim dsRowB As DataRow
'Online DS loaded earlier
For Each dsRow In frmMain.dsOnLine.Tables("TableName").Rows
dsRowB = dtOffLine.NewRow()
dsRowB.ItemArray = dsRow.ItemArray
dtOffLine.Rows.Add(dsRowB)
'' Tried this instead of the above three rows
' dtOffLine.ImportRow(dsRow)
Next
dtOffLine.AcceptChanges()
da.Update(dsOffLine, "TableName")
conSQL.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Thanks
Eric
Comment