Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 10th, 2006, 11:39 AM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please Help Me sorting this

Is Some there who can help me urgently

I am witing the code for updating a able in asp on the basis of form check box but it gives me error


[u]Error</u>

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/newproj/n/1234.asp, line 42

query_ins="update kn set status = 1 where orderno =rs("orderno")"
-------------------------------------------------------^


[u]Code</u>



<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
<%
conn_str = "Driver={SQL Server};Server=172.19.0.40;uid=sa;pwd=;database=pr iamsanity;"
set conn = server.CreateObject("adodb.connection")
conn.open conn_str
rs = Server.CreateObject("ADODB.recordset")
query="Select * from kn where status is null"
set rs=conn.execute(query)
%>
</head>
<body bgcolor="#D8F3DA">
 <form name ="form1" method="POST" action="1234.asp">
<table border="0" width="100%">
  <tr>
    <td width="25%" bgcolor="#008000" align="center">
       <p><b> Order Number</p>
     </td>
    <td width="25%" bgcolor="#008000" align="center"><b>Customer Name</b></td>
    <td width="25%" bgcolor="#008000" align="center"><b>Amount Due</b></td>
  </tr>
  <% while not rs.eof%>
    <tr>
    <td width="25%">
       <p><input type="checkbox" name="<%=rs("orderno")%>" value="1">&nbsp;&nbsp;&nbsp;<%=rs("orderno")%></p>
      </td>
    <td width="25%"><%=rs("custname")%></td>
    <td width="25%"><%=rs("amtdue")%></td>
  </tr>
<%

response.Write(request.Form(rs("orderno")))
if request.Form(rs("orderno")) = 1 then
set conn_ins = server.CreateObject("adodb.connection")
conn_ins.open conn_str
set rs_ins = Server.CreateObject("ADODB.recordset")
query_ins="update kn set status = 1 where orderno =rs("orderno")"
set rs_ins = conn_ins.execute(query_ins)
set rs_ins=nothing
end if
rs.movenext
Wend
%>

</table>
Note<textarea rows="2" name="S1" cols="84" name="note"></textarea>
<p align="center"><input type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>
<%
%>
  #2 (permalink)  
Old November 10th, 2006, 03:45 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You probably want to append the value from the recordset to the SQL statement, not make it part of the actual string. Try this:

query_ins = "update kn set status = 1 where orderno = " & rs("orderno")

This appends the value of the rs("orderno") to the SQL statement.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting member XSLT 25 July 13th, 2007 08:44 AM
SORTING pallone XSLT 3 October 29th, 2006 08:45 AM
Sorting sunny76 Excel VBA 2 September 19th, 2005 09:31 PM
Datagrid sorting by non alphabetical sorting? LLAndy VS.NET 2002/2003 1 July 15th, 2004 01:20 AM
Sorting? pbernardo XSLT 2 October 27th, 2003 11:34 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.