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, 10:14 AM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting an error!

Hi guys;

Can someone show or help fix this error am getting?

By the way I left the (Response.Write("SQL is " & strSQL)

On the screen I get:

 SQL is SELECT * FROM Escalation_Forms WHERE Ticket_Number = ''no records
Status:

ADODB.Field error '80020009'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/forms/results.asp, line 0

Quetion? Why is it saying no records? Did not recognize the number?


Please help! No solution yet!




 
Old July 26th, 2004, 12:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Can you post your code? It looks like you are passing 'no records' to the SQL statement.

 
Old July 26th, 2004, 01:02 PM
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 not using RESPONSE.END just in the next line to RESPONSE.WRITE, so it goes further down to execute your db execution and recordset contstruction codes.

Try this.
Code:
Response.Write "SQL is " & strSQL
Response.End
And post your resulting sql statement here, looks like you are missing something there.

Cheers!

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

It does show my the ticket number I have selected but somewhere in my code it doesn't execute that particular number all the way through. I don't mean to be a bother but can someone guide me through step by step on how to accomplish this task.
The output is: SQL is SELECT * FROM Escalation_Forms WHERE Ticket_Number = '29'

What do I have to do next?

Here's Code:
<%
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")




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">

</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, 01:58 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Few things. Is the ticket number numeric or text, because you have single quotes around it, which if it is numeric, these need to be removed. In addition, make sure the record exists.

What you may want to try to do is write out the query, copy/paste it into SQL Query Analyzer, and run it. See what results are returned.

Lastly, you may be starting at the BOF record, which you should move to the next record to start reading the records.

Brian
 
Old July 26th, 2004, 02:10 PM
Authorized User
 
Join Date: Jun 2004
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I verify to make sure the ticket numbers does excist in the database.
When I write the statement with quotes I get the following results:


Code:
strSQL= "SELECT * FROM Escalation_Forms WHERE Ticket_Number = '"& TicketNum & "'"

Output on screen:
SQL is SELECT * FROM Escalation_Forms WHERE Ticket_Number = '29'

Without:
strSQL= "SELECT * FROM Escalation_Forms WHERE Ticket_Number = TicketNum "

Output on Screen:
SQL is SELECT * FROM Escalation_Forms WHERE Ticket_Number = TicketNum

What should I do next! am I missisng any pieces in my code?

 
Old July 26th, 2004, 02:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Remove the single quotes only...

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

This Should read as...

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

Output on Screen:
SQL is SELECT * FROM Escalation_Forms WHERE Ticket_Number = 29

Hope that helps.
Cheers!

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

Here's what I have done!

By the way thank you!

I commented out the following codes.
'Response.Write("SQL is " & strSQL)
'Response.End()

 It displayed all the information but when I type close in the status text box and enter some comments in textarea.
Then hit submit I get the following error.
Microsoft OLE DB Provider for SQL Server error '80040e14'

Line 1: Incorrect syntax near '='.

/forms/results.asp, line 53

Line:53 is ObjRS.open strSQL, ObjConn, 3, 3





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

What page is this, which you commented out the response statements?

Is that different from "results.asp"? If so, you are doing the same mistake there in results.asp.

Hope that 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.