|
Subject:
|
expected end of statement....help....
|
|
Posted By:
|
chaoz83
|
Post Date:
|
9/18/2003 9:22:39 PM
|
i dun understand wat is wrong i've tried all ways but it juz cant work can someone tell me why?
<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>
|
|
Reply By:
|
vinyl-junkie
|
Reply Date:
|
9/21/2003 6:03:43 PM
|
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.
|
|
Reply By:
|
Imar
|
Reply Date:
|
9/22/2003 2:04:34 AM
|
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:<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.
|
|
Reply By:
|
jmss66
|
Reply Date:
|
9/23/2003 1:19:19 PM
|
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
|