ok Robby

Cinnamon
06-19-2002, 05:28 PM
I didn't mean to step on any toes. I'm just trying to get this silly problem solved. Sorry. Anyway, as to the results of your last post...

1) When "converted to long" everything worked fine. Until I attempted to update the "entry" field by entering text into the "Enter index information" box. It then generated the error message "Record Not Found". However, this is kind of good because that is MY error message and not a system message.

2) When I commented out the line you suggested and added
document.write(SearchThis) I got the following error message:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/myweb/new_page_2.asp, line 27

I know that it is finding the record because when I enter a number in the "enter record number" box and click submit---> it appears. I've entered numbers from 1 to 158982, the first and last records in the database and it always displays the records.

Ok, so what do we try next? I do appologize for being a pain in the neck.

Cinnamon

Robby
06-19-2002, 10:44 PM
I'm so sorry, I meant "response.write(SearchThis)"... But since the search is working, then there is no need to test the value of 'SearchThis'.

I really was kidding with my previous remark.

Ok, how far along are you.....

Are you able to display the users' search?

What do you need to do next? (Allow the user to edit a record via a text box?)

Cinnamon
06-20-2002, 07:40 AM
The search and display are working great. Now I need the user to be able to edit a field via a text box. As you will see in the code I have an input box to enter the text. However, when I enter text and click the submit button I get the "record not found" message. Which is odd because the search works and the record is on the screen.

I hope you're having a good day. It is terribly hot here... in the 90's and humid. YUK!

Cinnamon


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
</head>

<body>

<form action="new_page_2.asp" method="get">
Enter index information:
<input type="text" name="Cindex"><br><br>
<input type="submit" value="Submit">
</form>
<p>
<%
Dim cnnDatabase, rstDatabase, dtbDatabase, SearchThis, ImagePath, CardIndex

SearchThis = CLng(Request.QueryString("iRecordId"))
If IsNumeric(SearchThis) Then

cnnDatabase = "Driver=SQL Server;server=DIGITAL;database=gen_cards;uid=cinnamon;pwd=sinnamon"
Set rstDatabase=Server.CreateObject("ADODB.Recordset")
dtbDatabase = "SELECT * FROM Cards WHERE [unique]=" & SearchThis & ";"
rstDatabase.Open dtbDatabase, cnnDatabase, 3, 3
'document.write("SearchThis")

If NOT rstDatabase.EOF Then
ImagePath = rstDatabase.Fields("SQLpath")
Response.Write rstDatabase.Fields("entry")
%>
<img
src = ".<%= ImagePath %>"
width = "575"
height = "425"
/>
<br>
<%
CardIndex = Request.QueryString("Cindex")
rstDatabase.Fields("entry")=CardIndex


Else
Response.Write "Record not found"
End If

'rstDatabase.Close
'Set rstDatabase = Nothing
Else
Response.Write "Invalid input"
End If
%>
</body>
</html>

Robby
06-20-2002, 09:34 AM
It's 86 and dry here, as Loquin said "it's a dry heat so it feels like it's only 85."

Is the posted code in 'new_page_2.asp'? What I'm getting at is, are you posting back on itself?

Cinnamon
06-20-2002, 09:57 AM
Yes I'm posting back on itself. The code shows the method ="get". I've tried both "get and "post". I've also downloaded some example code from another site to try and figure out what I am doing wrong.

Cinnamon

P.S. Are you in Canada?

Robby
06-20-2002, 10:11 AM
yup, Canada.

Let's try the response.write(SearchThis), place it right after this line...

SearchThis = CLng(Request.QueryString("iRecordId"))

Cinnamon
06-20-2002, 10:24 AM
Here are the results...

1) I entered "1" into the "Enter record number" input box and a "1" appeared above the record.

2) I entered "test" in the "Enter index information" input box and a "0" appeared above the message "Record Not Found".

So that tells us that the initial search and display is working. However, when attempting to update a field the SEARCHTHIS variable is getting emptied.

Hmmmmm......

Cinnamon

p.s. I graduated from Plattsburgh HS and have been to Montreal many times.

Robby
06-20-2002, 10:31 AM
So you have one text box for both, right?
<input type="text" name="Cindex">

No problem.

Change the form tag to this...

<form action="new_page_2.asp?bSave=True" method="post">

then do this...

if Request.QueryString("bSave") = "True" then

//You can save your data here


So when this asp is called the first time, there is no bSave, any time this page calls itself, this parameter exists.

Cinnamon
06-20-2002, 11:12 AM
I have two input boxes. Here is what is supposed to happen...

1) Enter a record number and submit.
2) The record number displays including an image
3) The user enters a sentence "discribing" the image and clicks submit. This "discription" gets saved to a field in the record called ENTRY.

That's basically it. Does this change your recommendations from the previous post?

Cinnamon

Robby
06-20-2002, 11:29 AM
no, go ahead and make the changes.
Also put all you code from inside <% %> tags above the <html> tags. The only thing you need in you <body> should be <form>


Make 2 subs (Preview and SaveNow for example).

Then do this....

if Request.QueryString("bSave") = "True" then
SaveNow
else
Preview
end if

The code you have thus far would go into the Preview sub.

Cinnamon
06-20-2002, 12:28 PM
I keep getting a syntax error on my sub line.
[code]
<%
sub SaveNow

.... code....

end sub
%>

Being new to ASP I'm not sure that I'm calling or creating the subs correctly. I've been working from examples but I still get errors.

Thank you.

Cinnamon

Robby
06-20-2002, 12:41 PM
Put this at the top of your page (this should be the layout)

<%@ Language=VBScript %>
<%

your code starts here

%>
<html>

you html stuff here
</html>

Cinnamon
06-20-2002, 01:00 PM
Ok...Ok... I admit it...I had a blonde moment. Actually I have lots of them. As soon as I glanced at your post I said "Oh, I knew that! How silly of me".

Things are moving along quite well now. I'm close to having it working. However, now my image won't display. The record number is working because the entry field appears.


<%@ Language=VBScript %>
<%
If Request.QueryString("bSave")="True" Then
SaveNow
else
Preview
End if
%>

<%
Sub SaveNow()
Response.Write "save codehere"
end sub
%>

<%
Sub Preview()
Dim cnnDatabase, rstDatabase, dtbDatabase

SearchThis = CLng(Request.QueryString("iRecordId"))
Response.Write(SearchThis)
If IsNumeric(SearchThis) Then

cnnDatabase = "Driver=SQL Server;server=DIGITAL;database=gen_cards;uid=cinnamon;pwd=sinnamon"
Set rstDatabase=Server.CreateObject("ADODB.Recordset")
dtbDatabase = "SELECT * FROM Cards WHERE [unique]=" & SearchThis & ";"
rstDatabase.Open dtbDatabase, cnnDatabase, 3, 3

If NOT rstDatabase.EOF Then
ImagePath = rstDatabase.Fields("SQLpath")
Response.Write rstDatabase.Fields("entry")


Else
Response.Write "Record not found"
End If

'rstDatabase.Close
'Set rstDatabase = Nothing
Else
Response.Write "Invalid input"
End If
end sub
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
</head>
<body>
<img
src = ".<%= ImagePath %>"
width = "575"
height = "425"
/>
<br>
<form action="new_page_2.asp?bSave=True" method="post">
Enter index information:
<input type="text" name="Cindex"><br><br>
<input type="submit" value="Submit">
</form>
<p>

</body>
</html>

Robby
06-20-2002, 01:24 PM
anywhere inside the <body> put...

<%response.write(ImagePath)%>

Cinnamon
06-21-2002, 08:39 AM
The response write yielded a blank result. Which we suspected because it is no longer displaying the image.

Robby
06-21-2002, 10:48 AM
Do you have 'On Error Resume Next' anywhere? If so comment it out.

Cinnamon
06-21-2002, 11:02 AM
No, I do not have any error checking yet.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum