I can give you some pointers with ADO =o)
It is amazingly helpfull if you have a little knowledge of SQL when using ADO, but not neccessary..
first add "Microsoft Active Data Objects" from the reference list(i.e. ADO).
ADO functions primarily from two objects you declare, one is the connection, and one is the recordset. you only have to mess with the connection for a short while..so I won't focus on it too extensivly.
to start, go ahead and dim your main ado objeccts...
Dim adoRecordSet as new ADODB.RecordSet
Dim adoConnection as new ADODB.Connection
a few preliminary settings you want that apply to almost all projects..
adoRecordset.CursorLocation = adUseClient <--- this is important =o)
now you open the connection(the recordset runs through the connection to the database).
there are a few ways to open your ADO connection, using the vb6 wizard for database connectivity..tell it to generate you a "string", or you can build your own conneection string
below is a generic string to connect to a sql server.
adoConnection.Open "Provider=SQLOLEDB;Driver={SQL Server};Persist Security Info=False; Mode=Read|Write;uid=USERNAME;pwd=PASSWORD;server=m ysqlserver.com;database=mysqldatabase"
when that line is executed, your connections would open a link to a SQL database named 'mysqldatabase' at the network address 'mysqlserver.com', and try to login to it with USERNAME & PASSWORD.
That's all for the connection, now your recordset...we'll use a generic one that would return all the entries within a table.
adoRecordSet.Open "SELECT * FROM MYTABLE ORDER BY NAME", adOpenDynamic, adOpenLockOptimistic
now our recordset object can access all the records from "mytable", and they will be in order of the field "Name" in your database..the ORDER BY statement is completely optional.
to access them...you would use a bit of code like this:
adoRecordSet.MoveFirst 'this moves to the first record returned
Msgbox "Customers' Name: " & adoRecordSet!NAME
msgbox "Customers' Phone #" & adoRecordSet!PHONENUMBER
If you need to change a value in your recordset, do something liek this
adoRecordSet!NAME = "Bob's New Name"
adoRecordSet!PHONENUMBER = "555-555-5555"
adoRecordSet.Update 'this saves the current record
For your conversion, you could have 2 connection objects, one conneect to the new database, one conneccted to the old, and two recordsets...then just do something like this..
do while <> OldRecordSet.EOF
SoFar = SoFar + 1
NewRecordSet!Name = OldRecordSet!Name
NewRecordSet!Phone = OldRecordSet!Phone
NewRecordSet.Update
OldRecordSet.MoveNext
NewRecordSet.AddNew 'would create a new entry
lblprogress.caption = soFar & " from " & OldRecordSet.RecordCount
doevents
loop
At the end, just remember to do .Close on your recordsets, then your connections. I hope this has been helpfull, also, at
http://msdn.microsoft.com/library/de...conversion.asp you can find documentation on ADO references & ADO objects.
~hunter