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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Update of tables

Status
Not open for further replies.

sinistapenguin

Technical User
Jan 21, 2004
31
GB
Hi Again All

I have successfully managed to create a page that updates 2 tables and inserts into another.

I did this by following Cheech's advice and having a seperate page which read in the variables, then did the inserts.

I combined his advice with a DRDEV article on building Update Stored Procedures in Dreamweaver.

I now want to add another UPDATE command to this page where the page reads in 2 Session variables, then updates a table accordingly.

Whatever I do seems to result in a "Syntax error in UPDATE statement". This is what I have:
<%
if(Session(&quot;NewAuto&quot;) <> &quot;&quot;) then varNewAuto = Session(&quot;NewAuto&quot;)
if(Session(&quot;Prefix&quot;) <> &quot;&quot;) then varPrefix = Session(&quot;Prefix&quot;)
%>
<% *** all the standard DMX stored procedure code**
&quot;UPDATE AutoNumber SET Number = varNewAuto WHERE Prefix = 'varPrefix'&quot;
*** the rest of the standard DMX code***
%>

Are there any glaring errors in this code? - If you use the 'Wizard' to create the SP you get all sorts of &quot;+ Replace ('&quot;,&quot;' type stuff.

Even if I copy a piece of code that works and just change the names of the procedure and tables/ variables etc. It just won't work!!

Thanks in advance

Sinista
 
First obvious error is the building of the sql. The other thing I spot is the use of reserved words &quot;NUMBER&quot; is reserved. shows Access reserved words but there are many other sites that show sql etc...

Code:
<%
if(Session(&quot;NewAuto&quot;) <> &quot;&quot;) then varNewAuto = Session(&quot;NewAuto&quot;)
if(Session(&quot;Prefix&quot;) <> &quot;&quot;) then varPrefix = Session(&quot;Prefix&quot;)
%>
<% *** all the standard DMX stored procedure code**
sql = &quot;UPDATE AutoNumber SET Number = &quot; & varNewAuto &  &quot; WHERE Prefix = &quot; & varPrefix
*** the rest of the standard DMX code***
%>

Cheech

[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top