Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connection.execute RecordsAffected Problem

Status
Not open for further replies.

LuvASP

Programmer
May 18, 2000
46
US
I am executing an Insert query through connection object:

set conn = server.CreateObject("ADODB.connection")
conn.Open constr
conn.execute "INSERT INTO table1(val) SELECT val FROM table2", recs, adAsyncExecute

I keep getting a -1 in recs. What am I doing wrong? RecordsAffected just doesn't seem to work.

Thanks for any input.
 
one tip: all nested SQL statements have to be segragated by a ;
eg:
"INSERT INTO table1 (val) ; SELECT val FROM table2", recs, adAsyncExecute

I've always been partial to get my statements as I believe you're taking from one table and inserting to the next(?) into two seperate proceses. This makes for debugging ease
eg:
RS1 = "SELECT val FROM table2"
RS2 = "INSERT INTO table1 (column) (RS1)"

then you can debug it with response.write etc...

_____________________________________________________________________
Where have all my friends gone to????
onpnt2.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top