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

September 10th, 2003, 04:57 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok bad chioce of words: here is what I mean...
Connection.Close()
Set Connection = Nothing
Response.Redirect("ViewIThelp.asp")
' If the update is successful, redirect away
It works until I get to the point of save,
when I click save it goes to
http://my ip/asp/rod/Display2.asp?action=editsave
stops with a blank form, and did not update the database.
|
|

September 10th, 2003, 05:03 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Did you comment these two lines again?
Response.Write(strStatus)
Response.End()
Did you look at the source in the browser? The form may be blank, but maybe the browser is hiding the error details.
Another approach is to use a bunch of Response.Write("I am here") statements, for example:
Case "editsave"
' Updating, so take ID from Form
Response.Write("I am in editsave")
This makes it easier to see where the page is, where it goes and what it does.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

September 10th, 2003, 05:17 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok, Now I see I am in editsave at the top of my page,
The page works the same with or without these lines commented:
Response.Write(strStatus)
Response.End()
and when I view the source in the browser the input value are blank as well, :0
Sorry, Not much help am I?
|
|

September 10th, 2003, 09:02 PM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok I think maybe I down to the nitty gritty... I sure hope so,
I changed this:
intID = Request.Form("ID")
intID = Replace(intID, "'", "''")
If Len(intID) > 0 Then
To this:
intID = Request.form("ID")
intID = Replace(intID, "'", "''")
If IsNumeric(intID) then
intID = CLng(intID)
Else
intID = 0
End If
now my error is:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression ''Tandy' Lname = 'Powell' Email = oops phone = oops dept = 'one' repeat = 'no' priority = 'med' Comment = 'Just testing it help desk program' notes = '' tech = 'Ron' date = '3-21-99' time = '9:33' solved = '''.
asp/rod/Display2.asp, line 52
strSQL = "UPDATE tblIThelp SET " _
& "sFname = '" & (Request.Form("Fname")) & "' " _
& "Lname = '" & (Request.Form("Lname")) & "' " _
& "Email = '" & (Request.Form("email")) & "' " _
& "phone = '" & (Request.Form("phone")) & "' " _
& "dept = '" & (Request.Form("dept")) & "' " _
& "repeat = '" & (Request.Form("repeat")) & "' " _
& "priority = '" & (Request.Form("priority")) & "' " _
& "Comment = '" & (Request.Form("comment")) & "' " _
& "notes = '" & (Request.Form("notes")) & "' " _
& "tech = '" & (Request.Form("tech")) & "' " _
& "date = '" & (Request.Form("date")) & "' " _
& "time = '" & (Request.Form("time")) & "' " _
& "solved = '" & (Request.Form("solved")) & "' " _
& "WHERE (id = " & intID & ")"
'Response.Write(strStatus)
'Response.End()
Connection.Open strStatus
(LINE 52)Connection.Execute(strSQL)
Connection.Close()
|
|

September 11th, 2003, 01:18 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You should separate your values in your UPDATE statement with a comma:
UPDATE TableName SET Field1 = 'Bla', Field2 = 'Blabla'
The best way to do these kind of things, is use
Response.Write(strStatus)
Response.End()
and then paste the results of the Response.Write statement in Access. Access will tell you what the problems with your query are.
The solution to the problem with intID is not too good, though. If there is no ID present, you don't want to update record 0 (which probably won't even exist) but you want to cancel the update altogether. The fact that there is no intID present, is because you seemed to have removed the following line that I added in a previous post:
<input type="hidden" name="ID value="<%=intID%>">
This line of HTML with ASP saves the ID of the record the first time you request the page (when you view the details, but haven't changed and saved them yet). When you click the submit button, Request.Form("ID") will contain the ID of your record, so you can use it in the "editsave" part of your ASP code.
Put this line back in, add the comma's and I believe you're almost there.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

September 11th, 2003, 07:58 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Morning Imar,
OK I put the hidden field back (not sure how that got removed. Could be that I just over looked it. Changed the other back to the way it was (it was late I was trying any thing. Removed the comments on
Response.Write(strStatus)
Response.End()
and here is all the page says... Provider=Microsoft.Jet.OLEDB.4.0;Data Source= c:\inetpub\wwwroot\asp\rod\dbIThelp.mdb
my data base should be set up right, I reuse it for alot of these codes
|
|

September 11th, 2003, 08:40 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi again,
It's already afternoon here..... ;)
My bad; strStatus is your connection string. I meant strSQL as that's the one holding your UPDATE statement.
First, use:
Response.Write(strSQL)
Response.End
If the query looks OK, comment these lines and run the page again.
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

September 11th, 2003, 09:12 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hummmm I see a problem,
UPDATE tblIThelp SET sFname = '', sLname = '', semail = '', sphone = '' srepeat = '' spriority = '' scomment = '' stech = '' sdate = '' stime = '' snotes = '' sdept = '' ssolved = '' WHERE (id = 1)
I have two strSQL updates, one in the body
the other in case edit save.
The line above comes from the body strSQL
My brain is really moosh right now (I have a programming hang over I guess)  I have done nothing but this, sleep, and eat for 4 days now!
|
|

September 11th, 2003, 09:25 AM
|
|
Authorized User
|
|
Join Date: Sep 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Slap me, I commented out the body strSQL, I dont think it belongs there.....
but still have there error on line 51 Connection.Execute(strSQL)
Syntax error in UPDATE statement
POST Data:
Fname=Tandy&Lname=Powell& [email protected]& phone=254-399-6467&Dept=one&repeat=no&priority=med&ID=1&comment= Just+testing+the+help+desk+program&tech=Ron&date=3-21-99&time=9%3A33¬es=hum&Submit= . . .
When I Response.Write(strSQL) I get
I am in editsaveUPDATE tblIThelp SET sFname = 'Tandy', Lname = 'Osborn', Email = ' [email protected]', phone = '254-399-6467', dept = 'one', repeat = 'no', priority = 'med', Comment = 'Just testing it help desk program', notes = '', tech = 'Ron', date = '3-21-99', time = '9:33', solved = '', WHERE (id = 1)
|
|

September 11th, 2003, 09:31 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Ha, we made it to the second page of this thread:
= '', WHERE (id = 1)
There shouldn't be a comma before the WHERE clause:
= '' WHERE (id = 1)
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|
 |