My problem is I am dropping the first record in my Dataset when writing to the DB.
Can't figure out why I am not writing the first record to the DB. I have written out the Dataset and all records are included there. But, when I insert into the DB, the first record is absent.
Thanks
Thanks,
Greg
Code:
Dim MyDataSet As New DataSet
MyDataAdaptor.Fill(MyDataSet)
Dim MyDataRow As DataRow
Dim strSQL As String = ""
Dim sqlConnection As SqlClient.SqlConnection
Dim sqlCommand As SqlClient.SqlCommand
Dim sqlCommand2 As SqlClient.SqlCommand
For Each MyDataRow In MyDataTable.Rows
sqlConnection = New SqlClient.SqlConnectionstrConnection)
sqlConnection.Open()
strSQL = "INSERT INTO dbo.inv1000_bar_code_uploaded_schools VALUES('" & _
MyDataRow(6) & "','" & _
MyDataRow(1) & "','" & _
MyDataRow(2) & "','" & _
MyDataRow(3) & "','','" & _
MyDataRow(4) & "','" & _
MyDataRow(5) & "','" & _
MyDataRow(0) & "')"
sqlCommand2 = New SqlClient.SqlCommand(strSQL,sqlConnection)
sqlCommand2.ExecuteNonQuery()
sqlConnection.Close()
Next
Can't figure out why I am not writing the first record to the DB. I have written out the Dataset and all records are included there. But, when I insert into the DB, the first record is absent.
Thanks
Thanks,
Greg