Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 September 18th, 2003, 09:22 PM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default expected end of statement....help....

i dun understand wat is wrong i've tried all ways but it juz cant work can someone tell me why?

Code:
<SCRIPT LANGUAGE="VBScript">

Sub cancelButt_OnClick
    window.close()
    Session("sessDate")=""
End Sub

Sub okButt_OnClick
dim rmaNo, dateTxt

    rmaNo = document.shipdate.callID.value
    selectedDay = document.shipdate.day.value
    selectedMonth = document.shipdate.month.value
    selectedYear = document.shipdate.year.value
    dateTxt = selectedYear & "-" & selectedMonth & "-" & selectedDay & rmaNo

dim svr, Db, UID, Pwd
dim conn, rs, query
dim rmaNum, customerID
dim exist = "false"

svr = "(local)"
db = "HEAT"
uid = "heat"
pwd = "heat11**"

query = "SELECT a.CallId, c.CustID FROM Detail a, Subset c WHERE a.CallId = c.CallId and c.CustID = '" & Request.Cookies("HSS") & "' "

set conn = server.createobject("ADODB.connection")
set rs = server.createobject("ADODB.recordset")

conn.ConnectionString = "PROVIDER=SQLOLEDB; DATA SOURCE='" & svr & "'; INITIAL CATALOG='" & db & "'; USER ID='" & uid & "'; PASSWORD='" & pwd & "';" 

conn.open server.mappath("HEAT")

rs.open query, conn, adOS, adLO

rs.MoveFirst

do until rs.EOF

rmaNum = rs("CallId")
customerID = rs("CustID")

if customerID = Request.Cookies("HSS") then
    exist = "true"
end if

rs.moveNext
loop

rs.close
conn.close


End Sub

</SCRIPT>
 
Old September 21st, 2003, 06:03 PM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to vinyl-junkie
Default

Nothing jumps out at me as being glaringly wrong. Try commenting out portions of the code and running it. Also add Response.Write and Response.End statements to see if your code is being executed to a certain point before it blows up. Debugging like that can be time consuming, but it usually exposes where the problem is.

Hope this helps.

Pat Wong
http://www.napathon.net/ - Music Around The World
For collecting tips, trade and want lists, album reviews and more.
 
Old September 22nd, 2003, 02:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Nothing wrong? Hmmm, it seems to me there is a big mix up between server side VBScript and client side VBScript.

Take a look at this:
Code:
<SCRIPT LANGUAGE="VBScript">

...

Sub okButt_OnClick
...
    rmaNo = document.shipdate.callID.value
    selectedDay = document.shipdate.day.value
    selectedMonth = document.shipdate.month.value
...
set conn = server.createobject("ADODB.connection")
set rs = server.createobject("ADODB.recordset")
AFAICS, the okButt_OnClick will fire at the client when a user presses a button. Then you retrieve stuff from local HTML form objects using document., which takes place at the client as well.

However, the Server.CreateObject runs at the server.

You'll need to change your coding logic so that the client side button submits the form to the server. At the server you can then use Request.Form("MyFormElement") to retrieve the values from the form and pass them to a database so you can retrieve records from the database based on these values.


Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old September 23rd, 2003, 01:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default

The problem I see is you are issuing a command rs.MoveFirst. Your query might not be retrieving any record. If you are not sure that your SQL statement is populating the recordset, you might want to display the records so you know that the movefirst command is not the one giving you the problem.

Ex:

If not rs.eof then
  rs.movefirst
  response.write <fieldname> & <br>
Else
  response.write "End of File"
End If

Judy
  response.write





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Expected end of statement crabjoe Classic ASP Basics 3 December 4th, 2007 12:52 AM
Expected end islandtiu BOOK: Beginning ASP 3.0 5 January 17th, 2006 10:19 AM
Expected statement jonnyfive Classic ASP Basics 3 January 4th, 2006 07:04 PM
expected end of statement Adam H-W Classic ASP Databases 3 January 4th, 2005 05:37 AM
(0x800A03F6) Expected 'End' walrus Classic ASP Databases 5 April 15th, 2004 04:10 AM





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