|
-
Jul 10th, 2003, 06:11 PM
#1
Thread Starter
New Member
Dataset Update Problem
Hi,
I am trying to fill the dataset from an OleDB Source:
Function RunSQLWithDataSet(ByVal sql As String, ByVal TableName As String) As Dataset
Try
Dim oDataSet As New DataSet()
DBAdapter.SelectCommand = New OleDbCommand(sql, DBConn)
DBAdapter.Fill(oDataSet, TableName)
Return oDataSet
Catch e As Exception
MsgBox(sql & " " & e.Message)
End Try
End Function
And then send this dataset to a MS SQL server:
Sub UpdateFromDS(ByVal XMLFile As String, ByVal tblName As String, ByRef ds As Dataset)
Dim sql As String = "select * from " & tblName & " where 1=2"
Try
DBAdapter.SelectCommand = New SqlClient.SqlCommand(sql, DBConn)
setInsertCommand()
executeDeleteCommand("delete from " & tblName)
DBAdapter.Update(ds, tblName)
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
End Sub
But I see no update in the SQL server since it thinks that ds has no rows updated.
If I do ds.readXML from a file first, it updates SQL server properly... But it takes forever for big files.
How do I do the update without reading the XML file, by just transferring the dataset?
Thx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|