|
-
Nov 1st, 2002, 07:09 AM
#1
Thread Starter
Lively Member
move record {Resolved}
hi, is it possible to move a record from one db to antoher???
i'm using ADO and SQL
thanx in advance
splazz
Last edited by splazz; Nov 5th, 2002 at 08:11 AM.
-
Nov 1st, 2002, 08:28 AM
#2
Fanatic Member
Move:
cn.Execute "insert into newTable select * from oldTable"
cn.Execute "delete from oldTable"
Copy:
cn.Execute "insert into newTable select * from oldTable"
-
Nov 4th, 2002, 02:51 AM
#3
Thread Starter
Lively Member
thanx, but i've never heard of cn.Execute...
what about:
mySQL = "INSERT INTO historie SELECT * FROM bestilling WHERE id=" & bestid
splazz
-
Nov 4th, 2002, 10:59 AM
#4
Fanatic Member
Originally posted by splazz
thanx, but i've never heard of cn.Execute...
what about:
mySQL = "INSERT INTO historie SELECT * FROM bestilling WHERE id=" & bestid
splazz
All that is doing is allocating a SQL string to a variable mySQL. You still need to execute it...
-
Nov 5th, 2002, 02:12 AM
#5
Hyperactive Member
mySQL = "INSERT INTO historie SELECT * FROM bestilling WHERE id=" & bestid
YourConnection.Execute mySQL
-
Nov 5th, 2002, 03:20 AM
#6
Thread Starter
Lively Member
i don't understand much of it, but is this right?:
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
mystring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GMDB.mdb;Persist Security Info=False"
mySQL = "INSERT INTO historie SELECT * FROM bestilling WHERE id=" & bestid
con.Open (mystring)
rs.Open mySQL, con, adOpenKeyset, adLockOptimistic
con.Execute (mySQL)
rs.close
con.close
splazz
-
Nov 5th, 2002, 05:01 AM
#7
Fanatic Member
yes, but you don't need to open a recordset to execute it. just use this:
VB Code:
Set con = New ADODB.Connection
mystring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GMDB.mdb;Persist Security Info=False"
mySQL = "INSERT INTO historie SELECT * FROM bestilling WHERE id=" & bestid
con.Open (mystring)
con.Execute (mySQL)
con.close
-
Nov 5th, 2002, 07:39 AM
#8
Thread Starter
Lively Member
it won't work, i don't get any error-messages when i run it, but i don't moves anything...
splazz
-
Nov 5th, 2002, 07:45 AM
#9
Frenzied Member
If you don't suply column names and values you have to be sure all columns are identical in table historie and table bestilling and that they are of the same name , type and in the same order .
Code:
If Question = Incomplete Then
AnswerNextOne
Else
ReplyIfKnown
End If
cu Swatty
-
Nov 5th, 2002, 07:53 AM
#10
Are your ADO references set?
-
Nov 5th, 2002, 08:10 AM
#11
Thread Starter
Lively Member
thanx a lot guys, it works!!
it was just the column-problem...
splazz
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|