Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #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: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:45 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.