Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 29th, 2008, 09:14 PM
Registered User
 
Join Date: Apr 2008
Location: alor star, kedah, Malaysia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dayang
Default 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">&nbsp;&nbsp; </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>





Reply With Quote
  #2 (permalink)  
Old April 29th, 2008, 09:26 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
Reply With Quote
  #3 (permalink)  
Old April 29th, 2008, 10:59 PM
Registered User
 
Join Date: Apr 2008
Location: alor star, kedah, Malaysia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dayang
Default

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

Reply With Quote
  #4 (permalink)  
Old April 29th, 2008, 11:07 PM
Registered User
 
Join Date: Apr 2008
Location: alor star, kedah, Malaysia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dayang
Default

the "YES" in the database i have set it boolean yes/No

Reply With Quote
  #5 (permalink)  
Old April 29th, 2008, 11:14 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
Reply With Quote
  #6 (permalink)  
Old April 29th, 2008, 11:20 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
Reply With Quote
  #7 (permalink)  
Old April 29th, 2008, 11:26 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
Reply With Quote
  #8 (permalink)  
Old April 30th, 2008, 12:53 AM
Registered User
 
Join Date: Apr 2008
Location: alor star, kedah, Malaysia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dayang
Default

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

Reply With Quote
  #9 (permalink)  
Old April 30th, 2008, 01:05 AM
Registered User
 
Join Date: Apr 2008
Location: alor star, kedah, Malaysia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dayang
Default

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.

Reply With Quote
  #10 (permalink)  
Old April 30th, 2008, 01:07 AM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

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
Reply With Quote
Reply


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
Error Type:VBScript compilation(0x800A0401)IN DEL zedekiah BOOK: Beginning ASP 3.0 1 June 6th, 2008 11:08 PM
Microsoft VBScript compilation (0x800A0400) joeyjoejnr Classic ASP Databases 2 May 9th, 2007 03:22 AM
Microsoft VBScript compilation (0x800A03F6) ahmedonline5 Classic ASP Basics 1 March 12th, 2007 07:33 AM
Microsoft VBScript compilation (0x800A03EA) srm_kumar ASP.NET 1.0 and 1.1 Basics 1 November 10th, 2006 01:42 PM
Microsoft VBScript compilation (0x800A0400) cnottingham Classic ASP Databases 2 February 12th, 2004 10:11 AM



All times are GMT -4. The time now is 02:12 PM.


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