G
Guest
I'm using a VB.Net interface to load an Access table. The relationship is 1
input record to many table rows. The problem is that the first name of the
first row is populated for every row on the table (which curiously has the
correct total number of rows for the input file!). The reader does read the
data correctly.
If I put all the input record data into one row, it works perfectly.
Here's the partial code:
Dim objData as New DALBase
objData.SQL = "usp_LoadImportTable"
objData.InitializeCommand()
Line = objReader.ReadLine
' Code to read the input file and split the data into the desired fields -
works great.
objData.AddParameter("@ID", OleDb.OleDbType.VarChar, 10, strID)
objData.AddParameter("@Name", OleDb.OleDbType.VarChar, 50, strName1)
Call LoadTable()
objData.AddParameter("@ID", OleDb.OleDbType.VarChar, 10, strID)
objData.AddParameter("@Name", OleDb.OleDbType.VarChar, 50, strName2)
Private Sub LoadTable()
objData.OpenConnection()
intRowsAffected = objData.Command.ExecuteNonQuery()
' Error Handling
objData.CloseConnection()
End Sub
The Access SQL command "usb_LoadImportTable" is very simple:
INSERT INTO TempTable ID, Name FROM @ID, @NAME;
I figure that I need to clear the objData settings between the various
iterations of the input record, but everything I have tried has failed.
If the code extract isn't clear, I can email the actual Notepad file.
input record to many table rows. The problem is that the first name of the
first row is populated for every row on the table (which curiously has the
correct total number of rows for the input file!). The reader does read the
data correctly.
If I put all the input record data into one row, it works perfectly.
Here's the partial code:
Dim objData as New DALBase
objData.SQL = "usp_LoadImportTable"
objData.InitializeCommand()
Line = objReader.ReadLine
' Code to read the input file and split the data into the desired fields -
works great.
objData.AddParameter("@ID", OleDb.OleDbType.VarChar, 10, strID)
objData.AddParameter("@Name", OleDb.OleDbType.VarChar, 50, strName1)
Call LoadTable()
objData.AddParameter("@ID", OleDb.OleDbType.VarChar, 10, strID)
objData.AddParameter("@Name", OleDb.OleDbType.VarChar, 50, strName2)
Private Sub LoadTable()
objData.OpenConnection()
intRowsAffected = objData.Command.ExecuteNonQuery()
' Error Handling
objData.CloseConnection()
End Sub
The Access SQL command "usb_LoadImportTable" is very simple:
INSERT INTO TempTable ID, Name FROM @ID, @NAME;
I figure that I need to clear the objData settings between the various
iterations of the input record, but everything I have tried has failed.
If the code extract isn't clear, I can email the actual Notepad file.