EDN Admin
Well-known member
I have written lots of code with the ADO Library in VB Excel and previous versions of Visual Basic. With the dissappearance of the recordset object, how do we perform data manipulation with an attached Access Database? It seems things could be a lot easier,
and less complicated by now, however, the best methods appear to currently remain ellusive.
It seems the Table Adapter would be a great vehicle, However, I cannot seem to figure out how to encode the process.
Please let me know the best way to implement code similar to this:
Public Sub CreateLogic()
Let Query = "SELECT * FROM LogisticsTable1;"
Set rstLogistics = dbsCurData.OpenRecordset(Query, dbOpenDynaset)
With rstLogistics A recordset object
.AddNew
Let !Customer = strCustomer
Let !Product = strProduct
Let !Quantity = intQuantity
Let !Vendor = rstVendors!Supplier info from another table that was queried
If blnDemand = True Then Let !SendNow = 1
.Update
.Bookmark = .LastModified
.MoveLast
End With
Loop
End Sub
It would be great if something like this would work:
newLogisticsTableRow = LogisticsDataSet.LogisticsTable.NewLogisticsTableRow
Console.WriteLine("New Row; State = " & newLogisticsTableRow.RowState)
With newLogisticsTableRow
.BeginEdit()
!Customer = strCustomer
!Product = strProduct
!Quantity = intQuantity
!Vendor = rstVendors!Supplier info from another table that was queried
If blnDemand = True Then !SendNow = 1
.AcceptChanges()
.EndEdit()
End With
Console.WriteLine("Edited Row; State = " & newLogisticsRow.RowState)
LogisticsDataSet.LogisticsTable.Rows.Add(newLogisticsTableRow)
This looks like it would work great, however, the tables are not being updated and errors are coming up.
Can this be easily done with the TableAdaptors as well? I really like the Query Builders that have been created
I must be entering the wrong intellisense menus!
Please Help!!!
<hr class="sig gh
View the full article
and less complicated by now, however, the best methods appear to currently remain ellusive.
It seems the Table Adapter would be a great vehicle, However, I cannot seem to figure out how to encode the process.
Please let me know the best way to implement code similar to this:
Public Sub CreateLogic()
Let Query = "SELECT * FROM LogisticsTable1;"
Set rstLogistics = dbsCurData.OpenRecordset(Query, dbOpenDynaset)
With rstLogistics A recordset object
.AddNew
Let !Customer = strCustomer
Let !Product = strProduct
Let !Quantity = intQuantity
Let !Vendor = rstVendors!Supplier info from another table that was queried
If blnDemand = True Then Let !SendNow = 1
.Update
.Bookmark = .LastModified
.MoveLast
End With
Loop
End Sub
It would be great if something like this would work:
newLogisticsTableRow = LogisticsDataSet.LogisticsTable.NewLogisticsTableRow
Console.WriteLine("New Row; State = " & newLogisticsTableRow.RowState)
With newLogisticsTableRow
.BeginEdit()
!Customer = strCustomer
!Product = strProduct
!Quantity = intQuantity
!Vendor = rstVendors!Supplier info from another table that was queried
If blnDemand = True Then !SendNow = 1
.AcceptChanges()
.EndEdit()
End With
Console.WriteLine("Edited Row; State = " & newLogisticsRow.RowState)
LogisticsDataSet.LogisticsTable.Rows.Add(newLogisticsTableRow)
This looks like it would work great, however, the tables are not being updated and errors are coming up.
Can this be easily done with the TableAdaptors as well? I really like the Query Builders that have been created

I must be entering the wrong intellisense menus!
Please Help!!!
<hr class="sig gh
View the full article