dbTalk Databases Forums  

Update data from other table problem

comp.databases comp.databases


Discuss Update data from other table problem in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kelvin
 
Posts: n/a

Default Update data from other table problem - 04-15-2004 , 01:58 AM






hi,

I've this piece of code which could not work.
<%
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("database/mydatabase.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" &
MdbFilePath & ";"

sql = "UPDATE adhoc_history SET id2 = adhoc.adhoc_id FROM adhoc WHERE
adhoc_history.dealref = adhoc.dealref"
MyConn.execute(sql)

%>

I keep getting this error msg:-

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression 'adhoc.adhoc_id FROM adhoc'.

What is wrong with my code. I've seen examples which uses the same
method to
insert into db, but it doesn't work for me. Can someone help me?

Your help is muc appreciated.

Thank you.


kelvin

Reply With Quote
  #2  
Old   
Dave
 
Posts: n/a

Default Re: Update data from other table problem - 04-15-2004 , 11:30 AM






kelvin_teh (AT) singaporeair (DOT) com.sg (kelvin) wrote in message news:<17b259ca.0404142258.7de1cf1c (AT) posting (DOT) google.com>...

Try this...

UPDATE adhoc_history SET id2 = ( select adhoc.adhoc_id FROM adhoc WHERE
adhoc_history.dealref = adhoc.dealref )

Dave

Quote:
hi,

I've this piece of code which could not work.
%
Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("database/mydatabase.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" &
MdbFilePath & ";"

sql = "UPDATE adhoc_history SET id2 = adhoc.adhoc_id FROM adhoc WHERE
adhoc_history.dealref = adhoc.dealref"
MyConn.execute(sql)

%

I keep getting this error msg:-

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing
operator) in query expression 'adhoc.adhoc_id FROM adhoc'.

What is wrong with my code. I've seen examples which uses the same
method to
insert into db, but it doesn't work for me. Can someone help me?

Your help is muc appreciated.

Thank you.


kelvin

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.