Wrox Programmer Forums
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
Old November 10th, 2006, 11:39 AM
Registered User
Join Date: Nov 2006
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


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")"


<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=;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)
<body bgcolor="#D8F3DA">
 <form name ="form1" method="POST" action="1234.asp">
<table border="0" width="100%">
    <td width="25%" bgcolor="#008000" align="center">
       <p><b> Order Number</p>
    <td width="25%" bgcolor="#008000" align="center"><b>Customer Name</b></td>
    <td width="25%" bgcolor="#008000" align="center"><b>Amount Due</b></td>
  <% while not rs.eof%>
    <td width="25%">
       <p><input type="checkbox" name="<%=rs("orderno")%>" value="1">&nbsp;&nbsp;&nbsp;<%=rs("orderno")%></p>
    <td width="25%"><%=rs("custname")%></td>
    <td width="25%"><%=rs("amtdue")%></td>

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

Note<textarea rows="2" name="S1" cols="84" name="note"></textarea>
<p align="center"><input type="submit" value="Submit" name="B1"></p>
Old November 10th, 2006, 03:45 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

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.


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.