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 July 26th, 2004, 03:03 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am refering to the same page which is the result.asp. What can I do to fix that error? Code is posted above.

Thank you

 
Old July 26th, 2004, 03:19 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think you are confusing with the variable there, like you had a similar problem in your other post here Error Line 1: Incorrect syntax near '='. See this post, this might help you gain.;) There too it was the same page, but only the line number differs. (59 there and 53 here)

This error has many reasons for its failure. Check this too Error 80040e14

I could see you using both of these in same page.
TicketNum = Request.QueryString("TicketNum")
...
...
'somewhere down in the same page you are using
If request.form("TicketNum")<>"" Then

That leaves me confused. grrrr... I am not sure if you are sending TicketNum through both Querystring and FORM variable. But I don't see any <input text/hidden> with the name TicketNum with your FORM.

Let me have a cup of tea, by the time you get us some clue on this.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 26th, 2004, 03:57 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are obsolutely right! It's the same application I been working on and I can't seem to get in done! I did add an input the text/ hidden for the ticketNum. What else should I do? I'm only trying to have input text box and textarea updating information to the database.

Dim TicketNum, ObjConn, Conn, ObjRS, strSQL



set objConn=Server.CreateObject("ADODB.CONNECTION")

ObjConn.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Source_Forms;User Id=Source_Forms_User;Password=password;"

TicketNum = Request.QueryString("TicketNum")

if IsNumeric(TicketNum) = true then

    TicketNum = CInt(TicketNum)

else

    response.redirect("URL of the table that shows ticket numbers and customer's info as a link")

end if


Set ObjRS = Server.CreateObject("ADODB.Recordset")


strSQL= "SELECT * FROM Escalation_Forms WHERE Ticket_Number = " & TicketNum

'Response.Write("SQL is " & strSQL)
'Response.End()


ObjRS.open strSQL, ObjConn, 3, 3



If ObjRS.EOF Then

response.write("Something went wrong!")


Else



Response.Write"<br><b>Ticket Number:</b>" & objRS("Ticket_Number") & "<br>" &_

"<b>Status:</b>" & objRS("Status") & "<br>" &_

"<b>First Name:</b>" & objRS("First_Name") & "<br>" &_

"<b>Last Name:</b>" & objRS("Last_Name") & "<br>" &_

"<b>Customer Account Number:</b>" & objRS("Account_Number") & "<br>" &_

"<b>Customer Phone Number:</b> " & objRS("Phone_Number") & "<br>" &_

"<b>Tech Number:</b> " & objRS("Tech_Number") & "<br>" &_

"<b>Job Number:</b> " & objRS("Job_Number") & "<br>" &_

"<b>Custmer Comment:</b> " & objRS("Cust_Com") & "<br><br>"


End If



%>

<form action = results.asp method = post style="text-align: center">

<b>Status:</b>

<input type=text name="Status" value="<%= ObjRS("Status") %>" size="20">


<p><b>Feed Back:</b>

<textarea name="Wip_Com" rows="5" cols="20"><%= ObjRS("Wip_Com") %></textarea></p>
<p>



<span style="vertical-align: middle; font-weight: 700">
    <b>
    <a href="http://sflsource/forms/Eta_database3.asp">Return to Main Page&nbsp;&nbsp;</a>&nbsp;&nbsp;
</b> </span>&nbsp;<input type="submit"; name=" Update_Database" value="Update Database">
                <input type="hidden"; name="Status" value="Status">
                <input type="hidden"; name="Wip_Com" value="Wip_Com">
                <input type="hidden"; name="TicketNum" value="TicketNum">

</p>

</form>

<%


If request.form("TicketNum")<>"" Then
strSQL = "UPDATE Escalation_Forms SET Status='"& request.form("Status") &"', Wip_Com='"& request.form("Wip_Com") &"' Where Ticket_Number='"& request.form("TicketNum")&"'"


ObjConn.Execute strSQL
objRS.MoveNext
End if
ObjRS.Close
Set ObjRS = Nothing
ObjConn.Close
Set ObjConn = Nothing

%>

</body>
</html>

 
Old July 26th, 2004, 04:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

The solution to this is, Remove QUERYSTRING from here.
TicketNum = Request.QueryString("TicketNum")
Should read as
TicketNum = Request("TicketNum")

The reason for the error is, when you come from somewhere to RESULTS.asp, you pass the TicketNumber as Querystring. But on Submit of form, you do not get that as a querystring value, so that becomes empty and CAUSE this error in the immediate following select. Now this would fill the TicketNum Variable with relavant value(be it QueryString/Form Variable) at any cause, as you do a generic request.

Also remove the semicolon next to <input type="hidden";... there down in your code. Anyways that doesn't cause you any problem.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 27th, 2004, 08:53 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi I believe it resolved the problem with the ticketnum returning empty. When I hit submit I am getting page cannot be found! I look into the database to see if anything was updated in the database. No records was updated! Does this looks correct!

<form action ="Results.asp" method = post style="text-align: center">
<b>Status:</b>
<input type=text name="Status" value="<%= ObjRS("Status") %>" size="20">

<p><b>Feed Back:</b>

<textarea name="Wip_Com" rows="5" cols="20"><%= ObjRS("Wip_Com") %></textarea></p>
<p>
<span style="vertical-align: middle; font-weight: 700">
    <b>
    <a href="http://sflsource/forms/Eta_database3.asp">Return to Main Page&nbsp;&nbsp;</a>&nbsp;&nbsp;

</b> </span>&nbsp;<input type="submit"; name=" Results.asp" >

<input type="hidden" name="Status" value="Status">
<input type="hidden" name="Wip_Com" value="Wip_Com">
<input type="hidden" name="TicketNum" value="TicketNum">


 
Old July 27th, 2004, 01:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Calibus,

I am not sure why you get this error. As you say it is the same page to which you are submitting this form, that way you shouldn't face that error.

Also Remove the semicolon from there. And why is the Submit button named like " Results.asp" Can you try naming it with something meaningful and remove the preceding space from there too and see if that works fine after that.
Code:
<input type="submit"; name=" Results.asp" >
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old July 27th, 2004, 01:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

The <input type="submit"> redirects to the web page that is specified in the form action property, so if you have:

<form action="Results.asp">

You don't need to specify it in the <input type="submit"> button. It isn't allowed anyway.

Brian
 
Old July 30th, 2004, 12:57 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi first I want to thank taking the time out for helping me out with this. when I hit submit button I am getting error and it not writing to the database. I am not sure if it is passing the variable all the end of my code to be executed. I need some help with this.
Microsoft OLE DB Provider for SQL Servererror '80040e14'
Line 1: Incorrect syntax near '='.
/forms/Results.asp, line 55

Line 55 is :
ObjRS.open strSQL, ObjConn, 3,3
Code:

<%@ Language=VBScript %>
<%Option Explicit %>

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>
<body>
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#000000" width="985" height="50" id="table1" bgcolor="#000000">
<tr>
<td width="983" height="50" align="center">
<img border="0" src="LogoMasthead.gif" align="left" width="150" height="45"><img border="0" src="header_level3.jpg" width="828" height="48"></td>
</tr>
</table>
</center>
</div>
<p align="center">
Updating
Records
<p align="left">
&nbsp;
<%
Dim ObjConn, Conn, ObjRS, strSQL, TicketNumUpdate

set objConn=Server.CreateObject("ADODB.CONNECTION")
ObjConn.Open "Provider=sqloledb;Data Source=Flmirsql02;Initial Catalog=Source_Forms;User Id=Source_Forms_User;Password=password;"


TicketNumUpdate = Request("TicketNum")

Set ObjRS = Server.CreateObject("ADODB.Recordset")

strSQL = "SELECT * FROM Escalation_Forms WHERE Ticket_Number =" & TicketNumUpdate

'Response.Write("SQL is " & strSQL)
'Response.End()

ObjRS.open strSQL, ObjConn, 3,3

Response.Write"<br><b>Ticket Number:</b>" & objRS("Ticket_Number") & "<br>" &_
"<b>Status:</b>" & objRS("Status") & "<br>" &_
"<b>First Name:</b>" & objRS("First_Name") & "<br>" &_
"<b>Last Name:</b>" & objRS("Last_Name") & "<br>" &_
"<b>Customer Account Number:</b>" & objRS("Account_Number") & "<br>" &_
"<b>Customer Phone Number:</b> " & objRS("Phone_Number") & "<br>" &_
"<b>Tech Number:</b> " & objRS("Tech_Number") & "<br>" &_
"<b>Job Number:</b> " & objRS("Job_Number") & "<br>" &_
"<b>Custmer Comment:</b> " & objRS("Cust_Com") & "<br><br>"

If not ObjRS.EOF Then
ObjRS.MoveFirst
%>
<form action ="Results.asp" method = "post" style="text-align: center">
<b>Status:</b>
<tr>
<select name="Status" >
<option <%If ObjRS("Status")="" Then%>selected<%End If%>>Choose One</option>
<option value="Open" <%If ObjRS("Status")="Open" Then%>selected<%End If%>>Open</option>
<option value="Pending Research" <%If ObjRS("Status")="Pending Research" Then%>selected<%End If%>>Pending Research</option>
<option value="Close" <%If ObjRS("Status")="Close" Then%>selected<%End If%>> Close</option>
</select><p><b>
<input type="hidden" name="Status" value="Status">
<p><b>Feed Back:</b>
<textarea name="Wip_Com" rows="5" cols="20"><%=ObjRS("Wip_Com")%>
</textarea></p><input type="hidden" name="Wip_Com" value="Wip_Com">
<p>
<input type="hidden" name="TicketNumUpdate" value="<%=ObjRS("Ticket_Number")%>">

<span style="vertical-align: middle; font-weight: 700">
<b>
<a href="<A href="http://sflsource/forms/Eta_database3.asp">Return">http://sflsource/forms/Eta_database3.asp">Return to Main Page&nbsp;&nbsp;</a>&nbsp;&nbsp;
</b> </span>&nbsp;<input type="submit" Value="Update Database" >




</p>
</form>

<%
Else
strSQLUpdate = "UPDATE Escalation_Forms SET Status='"& request.form("Status") &"', Wip_Com='"& request.form("Wip_Com") &"' Where Ticket_Number='"& request.form("TicketNum")&"'"
'Response.Write("SQL is " & strSQL)
'Response.End()

ObjConn.Execute strSQLInsert

End if
ObjRS.Close
Set ObjRS = Nothing
ObjConn.Close
Set ObjConn = Nothing
%>

</body>
</html>


 
Old July 31st, 2004, 10:15 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Calibus,

I think you are confusing yourself as much as you can.

You care requesting for Request("TicketNum") at the top of the page.
Code:
TicketNumUpdate = Request("TicketNum")
...
strSQL = "SELECT * FROM Escalation_Forms WHERE Ticket_Number =" & TicketNumUpdate
But, somewhere down the page, your FORM contains a field called TicketNumUpdate
Code:
<input type="hidden" name="TicketNumUpdate" value="<%=ObjRS("Ticket_Number")%>">
But, at the bottom of the page you are requesting for request.form("TicketNum"), which doesn't exist in your FORM at all.
Code:
strSQLUpdate = "UPDATE Escalation_Forms SET Status='"& 
request.form("Status") &"', Wip_Com='"& request.form("Wip_Com") &"' 
Where Ticket_Number='"& request.form("TicketNum") &"'"
So what you are trying to do at last is, you are requesting for something that is not in your form, so obviously
TicketNumUpdate
or
Request("TicketNum")
or
request.form ("TicketNum")

will all hold NOTHING, which results in your lucky error Line 1: Incorrect syntax near '='.. It looks like you don't want to get rid of this error after a long time.:) As Jonax suggested in the other post to change the name from Ticket_Number to TicketNum on the right-hand-side, now you have mixed up with changing the Name of the Variable on the left-hand-side and using something else down the page.

I would suggest you to go through some books that covers concept of FORM values submission and retrieval.

When a "txtVAR" field exists in a FORM, only that "txtVAR" can be requested on the page where it gets submitted. You cannot request for something else and look for value in that.

I would say, you change the above mentioned line in the following way.
Code:
TicketNumUpdate = Request("TicketNum")
...
strSQL = "SELECT * FROM Escalation_Forms WHERE Ticket_Number =" & TicketNumUpdate
Within the FORM...
Code:
<input type="hidden" name="TicketNum" value="<%=ObjRS("Ticket_Number")%>">
At the bottom...
Code:
strSQLUpdate = "UPDATE Escalation_Forms SET Status='"& 
request.form("Status") &"', Wip_Com='"& request.form("Wip_Com") &"' 
Where Ticket_Number='"& TicketNumUpdate &"'"
This should help you get rid of Line 1: Incorrect syntax near '='., but not sure what else would surface.
Also I don't understand why you are using other hidden fields in the FORM? But I really don't want to confuse you more now, will discuss about that later.

Hope this helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert Query Error & Run-Time Error 3022 DavidWE Access 1 July 31st, 2008 11:17 AM
Ch 4: Parse error: syntax error, unexpected T_SL hanizar77 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 June 23rd, 2008 09:17 PM
[Resolved] Error calling a sp - parameter error snufse .NET Framework 2.0 2 February 12th, 2008 04:46 PM
Parse error: syntax error, unexpected T_STRING ginost7 Beginning PHP 1 November 9th, 2007 02:51 AM
Phile Page error, visual studio error reps BOOK: ASP.NET Website Programming Problem-Design-Solution 0 September 27th, 2003 10:11 AM





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