G
Guest
Hello everyone,
Are there any issues regarding using ADO, not ADO.NET inside of VB.NET? I
have a piece of code that loads a Visual Fox Pro table but stops working
after the 30th record has been loaded.
Here is a some of the code.
adoRS = New ADODB.Recordset()
adoCN = New ADODB.Connection()
RowArray = flat.Tables(0).Select("sequence=" &
row.Item("sequence").ToString)
If RowArray.Length = 0 Then
Try
adoCN.ConnectionString = tblDestinationConn
adoCN.Open()
adoRS.CursorLocation = ADODB.CursorLocationEnum.adUseClient
adoRS.LockType = ADODB.LockTypeEnum.adLockPessimistic
adoRS.CursorType = ADODB.CursorTypeEnum.adOpenDynamic
adoRS.Open("select * from csesend", adoCN, , ,
ADODB.CommandTypeEnum.adCmdText)
adoRS.AddNew()
For Each col In flat.Tables(0).Columns
If Not TypeOf row.Item(col.ColumnName) Is System.DBNull Then
If Trim(row.Item(col.ColumnName)) = "" Then
adoRS.Fields(col.ColumnName).Value = ""
Else
adoRS.Fields(col.ColumnName).Value = row.Item(col.ColumnName)
End If
Else
Select Case adoRS.Fields(col.ColumnName).Type
Case ADODB.DataTypeEnum.adDate
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case ADODB.DataTypeEnum.adDBDate
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case ADODB.DataTypeEnum.adDBTime
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case ADODB.DataTypeEnum.adDBTimeStamp
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case Else
adoRS.Fields(col.ColumnName).Value = ""
End Select
End If
Next
adoRS.Update()
adoRS.Close()
adoRS = nothing
adoCN.Close()
adoCN = nothing
Catch ex As Exception
MsgBox(ex.Source & vbCrLf & ex.Message)
End Try
After the 30th record is loaded I get the error message:
-2147217887
Multiple-step operation generated errors. Check each status value.
The error is occuring on the adoRS.Update() line.
Any suggestions? I am currently recoding the Application to use ADO.NET
with ADO.NET's update command.
Any help would go along way!
Markus McGee
Are there any issues regarding using ADO, not ADO.NET inside of VB.NET? I
have a piece of code that loads a Visual Fox Pro table but stops working
after the 30th record has been loaded.
Here is a some of the code.
adoRS = New ADODB.Recordset()
adoCN = New ADODB.Connection()
RowArray = flat.Tables(0).Select("sequence=" &
row.Item("sequence").ToString)
If RowArray.Length = 0 Then
Try
adoCN.ConnectionString = tblDestinationConn
adoCN.Open()
adoRS.CursorLocation = ADODB.CursorLocationEnum.adUseClient
adoRS.LockType = ADODB.LockTypeEnum.adLockPessimistic
adoRS.CursorType = ADODB.CursorTypeEnum.adOpenDynamic
adoRS.Open("select * from csesend", adoCN, , ,
ADODB.CommandTypeEnum.adCmdText)
adoRS.AddNew()
For Each col In flat.Tables(0).Columns
If Not TypeOf row.Item(col.ColumnName) Is System.DBNull Then
If Trim(row.Item(col.ColumnName)) = "" Then
adoRS.Fields(col.ColumnName).Value = ""
Else
adoRS.Fields(col.ColumnName).Value = row.Item(col.ColumnName)
End If
Else
Select Case adoRS.Fields(col.ColumnName).Type
Case ADODB.DataTypeEnum.adDate
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case ADODB.DataTypeEnum.adDBDate
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case ADODB.DataTypeEnum.adDBTime
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case ADODB.DataTypeEnum.adDBTimeStamp
adoRS.Fields(col.ColumnName).Value = #12/30/1899#
Case Else
adoRS.Fields(col.ColumnName).Value = ""
End Select
End If
Next
adoRS.Update()
adoRS.Close()
adoRS = nothing
adoCN.Close()
adoCN = nothing
Catch ex As Exception
MsgBox(ex.Source & vbCrLf & ex.Message)
End Try
After the 30th record is loaded I get the error message:
-2147217887
Multiple-step operation generated errors. Check each status value.
The error is occuring on the adoRS.Update() line.
Any suggestions? I am currently recoding the Application to use ADO.NET
with ADO.NET's update command.
Any help would go along way!
Markus McGee