i have 2 table in my database access 1 is temporary and the second one is temporary2, how can i save all the data in temporary to temporary2? im using adodb.

Recommended Answers

All 5 Replies

you can use recordset for the purpose.

open a recordset from temp table and insert to temp2 table.
later if you want to delete the records from temp then go for it.

how can i do that? in coding?

select all records from temp table into recordset.

insert to temp2 table in a loop and finally commit.

:( i still i can't get!

i have 2 table in my database access 1 is temporary and the second one is temporary2, how can i save all the data in temporary to temporary2? im using adodb.

try this code...

rs.Open "select * from temporary1", gcn

gcn.Execute "delete from temporary2"

If rs.RecordCount > 0 Then
    rs.MoveFirst
    While Not rs.EOF()
        gcn.Execute "insert into temporary2(roll,name,address) values('" & rs!roll & "','" & rs!Name & "','" & rs!address & "')"
        rs.MoveNext
    Wend
End If

If rs.State = adStateOpen Then rs.Close
Set rs = Nothing

where gcn is the connection and rs is the recordset object respectively....replace these with your objects....

check out the statement which is marked as red...this is the sql statement you need to modify according to the fields you have in your tables....this statement will extract one row from temporary1 table and insert it to temporary2 table...

hope this helps....get me a feedback if this works out...

regards
Shouvik

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.