I'm trying to move a data set filled from an OLEDB data source into a SQL
Server using the routine below. I get no errors, but when I look, there are
no records in the SQL server table, "test". I know that there are records
in the data set (ds.Tables(0).Rows.Count = 69) so why are the records not
moved into the "test" table? Any help would be greatly appreciated.
Dim cnSource As OleDbConnection
Dim cnDest As SqlClient.SqlConnection
Dim strSQL As String
cnSource = New
OleDbConnection("Provider=IBMDADB2.1;Password=123;User ID=USR;Data
Source=DB2DB;Mode=Read;Extended Properties=''")
cnSource.Open()
Dim daSource As New OleDb.OleDbDataAdapter("SELECT DISTINCT
DBSVR.TABLE1.SITE_CD FROM DBSVR.TABLE1", cnSource)
Dim ds As DataSet = New DataSet()
daSource.Fill(ds, "test")
cnSource.Close()
cnDest = New
SqlClient.SqlConnection("Server=SQLSVR;database=test;UID=testUSR;PWD=123")
Dim daDest As New SqlClient.SqlDataAdapter("SELECT * FROM test",
cnDest)
Dim cmB As SqlClient.SqlCommandBuilder = New
SqlClient.SqlCommandBuilder(daDest)
cnDest.Open()
daDest.Update(ds, "test")
cnDest.Close()