adding bulk of records into database

dec21st

Active member
Joined
May 14, 2005
Messages
43
Programming Experience
3-5
i have a piece of vb codes that i want to use it in vb.net

VB.NET:
//declare 2 recordset of different database
 
while rs1.eof
rs1.addnew
rs1.fields("id1") = rs2.fields("id2")
rs1.fields("abc1") = rs2.fields("abc2")
rs1.fields("type") = "abc"
rs2.movenext
end while

how do i do this using vb.net n ado.net? i'm kinda unfamiliar with that.

i'm writing a function that will retrieve a bulk of records from one database(in this example rs2) then inserting it into another new database(rs1). if i use sqlcommand to keep inserting a record one by one (this will use another sqlreader to read from another datasource), it would not be effective as we're dealing with alot of records here.

how do i do this in vb.net?
 
You can still use this code in VB.NET, but it's recommended to use ADO.NET as you've pointed out.

There are many examples on this forum, specifically the categories that deal with Data Access:

Data Access forum @ VbDotNetForums.com
Database General Discussion @ VbDotNetForums.com

I would suggest using dataAdapters and dataSets.
Now to be picky; in your code rs1 & rs2 are actually recordSets not dataBases. They are similar to the dataSets in ADO.NET.

Have a look in the past forum posts and feel free to post more questions.
 
Back
Top