 |
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics 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
|
|
|

April 29th, 2008, 09:14 PM
|
Registered User
|
|
Join Date: Apr 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Microsoft VBScript compilation (0x800A0401)
I try to find what is the problem is but i cant find the solution. I always get this error. can anyone out there willing to help me?
plez help me.
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/reservation/detail1.asp, line 83, column 61
Insertsql_update = "update" & szTable & "(Status) VALUES ('" Yes "')" & " where iid = 24 " & sSQL
------------------------------------------------------------^
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<body bgcolor="#FFFFFF" >
<%
on error resume next
msg=""
Action = LEFT(UCase(Request("Action")),3)
if Action = "" then
Action = LEFT(Ucase(Response.QueryString("action")))
end if
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=c:\Inetpub\wwwroot\reservation\eservices1.mdb "
szDB = DSNtemp
szTable = "Service"
szID = Request.QueryString("Date_Res")
szDetail = Request.querystring("detail")
sSQL="Update szTable"
sql = "select * from " & szTable & " where iid = " & szID
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open szDB
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, Conn, 1, 4
rs.PageSize=1
if Action = "SAV" then
for j = 1 to rs.fields.count -1
if instr(rs(j).name,"iid") > 0 then
else
rs(j).value = request.form(rs(j).name)
end if
next
rs.updatebatch
msg = "SAVED"
response.redirect "ado1.asp"
end if
if Action = "NEW" then
sql = "select max(iid) from " & szTable
set rs0 = Conn.Execute(sql)
InsertSql = "insert into " & szTable & "(Date_Res) VALUES ('" & rs0(0) + 1 & "')"
Conn.Execute(InsertSql)
response.redirect "detail1.asp?Date_Res=" & rs0(0) + 1
end if
if Action = "DEL" then
sql = "delete from " & szTable & " where iid = " & szID
Conn.Execute(sql)
response.redirect "ado1.asp"
end if
if Action = "BRO" then
szID = ""
end if
if szID = "" or szTable = "" then
response.redirect "ado1.asp"
end if
if Action = "APP" then
for j = 1 to rs.fields.count -1
if instr(rs(j).name,"iid") > 0 then
else
rs(j).value = request.form(rs(j).name)
end if
next
rs.updatebatch
msg = "APPROVE"
sql = "select max(iid) from " & szTable
set rs0 = Conn.Execute(sql)
Insertsql_update = "update" & szTable & "(Status) VALUES ('" Yes "')" & " where iid = 24 " & sSQL
Conn.Execute(InsertSql_update)
con.Close
Set con= Nothing
response.redirect "ado1.asp"
end if
%>
<html>
<head>
<title>Detail</title>
<meta name="Microsoft Theme" content="none, default">
</head>
<body>
<form method="post" action="detail1.asp?Date_Res=<%=szID%>">
<table width="86%" cellspacing="0" cellpadding="0" border="0">
<tr>
<th width="72%" align="Left" nowrap><%= Ucase(mid(szTable,1,1)) & mid(szTable,2)%> Detail
<input type="submit"
value="SAVE" name="action">
<input
type="submit" value="NEW" name="action">
<input type="submit" value="BROWSER"
name="action">
<input type="submit" name="Submit" value="APPROVE">
<input type="submit" value="DELETE" name="action">
</th>
<td valign="Middle" align="Middle" width="7%" ><a href="calendar_v1.asp"> Exit</a> <br>
</td>
<td valign="Middle" align="Middle" width="16%" ><a href="menutransaction.asp"> </a><br>
</td>
<td valign="Middle" align="Right" width="5%"><%= msg%> </td>
</tr>
<tr>
<td bgcolor="#FFFFCC" colspan="2"> </td>
</tr>
</table>
<table align="left">
<tr align="left">
<td align="left" valign="top" width="30">
<%
j=0
For i = 1 to rs.Fields.Count -1
%>
<% if j >= 9 then %>
<% j=0 %>
</td>
<td align="left" valign="top" width="242">
<%end if%>
<b><%=rs(i).Name %> </b>
<textarea name="<%=rs(i).Name %>" cols="30"><%=rs(i).Value %></textarea>
<%
j=j+1
Next
%>
</td>
</tr>
<tr>
<td></td>
</tr>
<br>
</table><br><br>Enter Your Date Reservation <br>
Today
<%
var_date=date() 'get the current date
var_date=FormatDateTime(var_date,1)
Response.Write(var_date)
%><br>
</form>
</body>
</html>
|

April 29th, 2008, 09:26 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
is 'Yes' a variable? if so you need to Surround it with &'s if not remove the quotes your statement is already a string.
Wind is your friend
Matt
www.elitemarquees.com.au
|

April 29th, 2008, 10:59 PM
|
Registered User
|
|
Join Date: Apr 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the funtion of YES is when the admin want to approve the request from user
she will click buttonn approve
so in the database,i have set the value is default
that is mean NO, it will turn automatic to YES in the database.
based on your experience,do you thing that my coding is correct?
i'm so sorry
this is my first experience
plez help me
i really lost rite now
i dont know what is you point is
my approve button is not funtion
|

April 29th, 2008, 11:07 PM
|
Registered User
|
|
Join Date: Apr 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
the "YES" in the database i have set it boolean yes/No
|

April 29th, 2008, 11:14 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
I cant see where I refered to the word function. I asked is 'Yes' was a variable, is it?
If so you would need to:
('" & Yes & "')
if not you can not use it in an SQL statement like you are.
The field 'Status' what type of data is it expecting? string, integer, yes/no etc...
What type of DB are you using?
I assume Access and the status field is a 'Yes/No' data type?
If so your need to insert either -1 for yes and 0 for no from memory
Wind is your friend
Matt
www.elitemarquees.com.au
|

April 29th, 2008, 11:20 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
I see... Very good you answered my question before I even asked it :o)
As mentioned above:
Access yes/no fileds expect an integer:
(" & -1 & ") 0r (-1) - this inserts a yes
or
(" & 0 & ") 0r (0) - this inserts a no
Note - SQLServer (a bit data type which is the equivalent) 0 = no and 1 = yes (mmm very strage I have always thought)
Wind is your friend
Matt
www.elitemarquees.com.au
|

April 29th, 2008, 11:26 PM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
A correction:
This is what I mean by using a variable:
dim myValue
myValue = -1
(" & myValue & ")
Or just insert it into the statement direct
Wind is your friend
Matt
www.elitemarquees.com.au
|

April 30th, 2008, 12:53 AM
|
Registered User
|
|
Join Date: Apr 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
YES NO is a boolean
my database used microsoft access
i try to correct it but i cannot find the way out
i am so sorry to gave you trouble
but i really lost
feel dizzy
can you correct it for me
because i'm a practical student n my lecturer want to see my system funtioning
my sistem is almost complete
except my APPROVE funtion
plez help me
you are so kind
you willing to help me
wish i can see you
|

April 30th, 2008, 01:05 AM
|
Registered User
|
|
Join Date: Apr 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
status is for yes or no
if the request accepted by the admin
it will turn to yes
i have try change the (" & Yes& "),but still i got the same error,
end statement
i try to change to (" & -1 & "), but the same error i det
help me
i gone die if my lecturer knows.
|

April 30th, 2008, 01:07 AM
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
Am happy to help however its home time in Australia now
Back to your problem its because of the quotes around the Yes in your statement. You are using Yes like a variable however from what I gather its not. As my post above says this type of field can not accept a string it must be either -1 or 0
Write your query to the browser and use paste it in the query window within access to trouble shoot it. Good luck, Its home time for me now.
Wind is your friend
Matt
www.elitemarquees.com.au
|
|
 |