navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Free FrontPage Templates

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Update Database problem

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Update Database problem
Page: [1]
 
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
Update Database problem - 3/31/2002 10:48:42   
I've found this custom query from a link off this site:
update CALENDAR Set Event_Name='::Event_name::' WHERE Event_Name='::Event_Name::'

When I make the changes in the update field and click submit, it goes to the second page for a confermation using the query above. How do I get it to amend that change to the database?

To better understand what I'm trying to say, check the link out here: http://www.glencoechamber.com/edit_cal.asp
Thanks for your time.

Edited by - nmathews on 03/31/2002 22:23:56
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update Database problem - 4/1/2002 6:10:07   
What you are doing, is updating event_name = event_name. The same value.
So in effect you are doing nothing.
You need to have an old_event_name and a new_event_name like so :

update CALENDAR Set Event_Name='::new_Event_name::' WHERE Event_Name='::old_Event_Name::'

So, you may need to keep the current (old_event_name) as a hidden value in the form.

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/1/2002 20:14:22   
ok. I used the sql that you sugested:
update CALENDAR Set Event_Name='::new_Event_name::' WHERE Event_Name='::old_Event_Name::'

and when I update the field it updates the field, but its blank. I've downloaded the database so play around with it.


(in reply to nmathews)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update Database problem - 4/1/2002 22:58:36   
Youll also need to include the value of the current database value in a hidden form field.

eg :

<input type=hidden name=old_event_name value="<%=fp_field("fp_rs,("event_name")%>">

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/2/2002 8:28:57   
I added that field on the second page, but now I get a page not displayed with this error:

Error Type:
Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/edit_cal1.asp, line 85, column 33
Response.Write(fp_field("fp_rs,("event_name"))




(in reply to nmathews)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update Database problem - 4/2/2002 22:53:00   
<input type=hidden name=old_event_name value="<%=fp_field(fp_rs,"event_name")%>">



§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/3/2002 11:41:20   
Thanks for your support Spooky, but I'm still getting error messages.

Here is the html part of the page:

<p align="left"></p>
<form BOTID="0" METHOD="POST" ACTION="edit_cal.asp">
<table BORDER="0">
<tr>
<td><b>new_Event_name</b></td>
<td><input TYPE="TEXT" NAME="new_Event_name" VALUE="<%=Request("new_Event_name")%>" size="20"></td>
</tr>
<tr>
<td><b>old_Event_Name</b></td>
<td><input TYPE="TEXT" NAME="old_Event_Name" VALUE="<%=Request("old_Event_Name")%>" size="20"></td>
</tr>
<tr>
<td></td>
<td><input type=hidden name=old_event_name value="<%=fp_field(fp_rs,"event_name")%>"> </td>
</tr>
</table>

The error is:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required
/_fpclass/fpdblib.inc, line 12


(in reply to nmathews)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update Database problem - 4/3/2002 23:50:09   
The original form pulled the values from the database did it not?
You dont appear to have any other database values here now?

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/4/2002 7:52:44   
The orginal page took the record from the first page and put it all by its self on the second page by posting it from one page to the next. I dont think it pulled anything from the database on the second page.

What should I do. I'm kinda lost


(in reply to nmathews)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update Database problem - 4/4/2002 15:44:23   
Thats cool, just do it this way :

<input type=hidden name=old_event_name value="<%=request("event_name")%>">

You shouldnt display a text box for the same value, it means users could change it.

<text box > New event
<hidden> old event

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/4/2002 16:53:12   
Spooky, which page am I suppose to put that on? I think I keep getting more confuesed. Should page 2 just be paragraphs other than text boxes?


(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/7/2002 10:00:13   
Does someone have a working version of form that edits the database that I could somewhat look at? If someone could post their code it would help a lot.

Thanks


(in reply to nmathews)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Update Database problem - 4/7/2002 22:21:21   
Ok, lets back up a bit.
You have a page that displays current events:
http://www.glencoechamber.com/edit_cal.asp

It pulls the data from the database.
Here is where you need the "hidden" field we talked about above.

BUT! I feel you actually need to use the UNIQUE id of the record, as you will end up modifying ALL records that contain the event name text. Is this what you want?

§þððk¥
Database / DRW Q & A
VP-ASP Shopping cart
Spooky Login

(in reply to nmathews)
nmathews

 

Posts: 50
Joined: 2/10/2002
From:
Status: offline

 
RE: Update Database problem - 4/7/2002 22:34:18   
Well I dont want to modify all of them. I dont know if I can use a id field. I'm not using a access database. I'm using a dbase database file. I have a form set up that deletes the record, but it sends the record that i want to delete to a second page then deletes just that record. Could the same be done to modify a record?


(in reply to nmathews)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Update Database problem
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts