Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 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
  #11 (permalink)  
Old September 10th, 2003, 04:57 PM
Authorized User
 
Join Date: Sep 2003
Location: Waco, TX, .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

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.
Reply With Quote
  #12 (permalink)  
Old September 10th, 2003, 05:03 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
Reply With Quote
  #13 (permalink)  
Old September 10th, 2003, 05:17 PM
Authorized User
 
Join Date: Sep 2003
Location: Waco, TX, .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

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?
Reply With Quote
  #14 (permalink)  
Old September 10th, 2003, 09:02 PM
Authorized User
 
Join Date: Sep 2003
Location: Waco, TX, .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

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()
Reply With Quote
  #15 (permalink)  
Old September 11th, 2003, 01:18 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
Reply With Quote
  #16 (permalink)  
Old September 11th, 2003, 07:58 AM
Authorized User
 
Join Date: Sep 2003
Location: Waco, TX, .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

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
Reply With Quote
  #17 (permalink)  
Old September 11th, 2003, 08:40 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
Reply With Quote
  #18 (permalink)  
Old September 11th, 2003, 09:12 AM
Authorized User
 
Join Date: Sep 2003
Location: Waco, TX, .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

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!
Reply With Quote
  #19 (permalink)  
Old September 11th, 2003, 09:25 AM
Authorized User
 
Join Date: Sep 2003
Location: Waco, TX, .
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to TnTandyO Send a message via Yahoo to TnTandyO
Default

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=tosborn@hot.rr.com& 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&notes=hum&Submit= . . .

When I Response.Write(strSQL) I get

I am in editsaveUPDATE tblIThelp SET sFname = 'Tandy', Lname = 'Osborn', Email = 'tosborn@hot.rr.com', 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)
Reply With Quote
  #20 (permalink)  
Old September 11th, 2003, 09:31 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
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
How to Edit record right after it was Inserted? aladov ASP.NET 2.0 Professional 4 December 11th, 2007 03:18 PM
Adding a blank record to a grid (in edit-mode) ColSandrs ASP.NET 1.0 and 1.1 Basics 1 December 21st, 2005 08:42 AM
Edit record help dbartelt Access 4 November 9th, 2005 06:02 PM
Update or CancelUpdate without AddNew or Edit ru1 Access 1 October 15th, 2005 02:24 PM
edit, update method life_s Ng ASP.NET 1.0 and 1.1 Basics 5 August 19th, 2003 10:45 PM



All times are GMT -4. The time now is 03:06 AM.


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