navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
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

Search Forums
 

Advanced search
Recent Posts

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

Microsoft MVP

 

RE: Updating Access DB from .asp Form

 
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 >> RE: Updating Access DB from .asp Form
Page: <<   < prev  1 [2] 3   next >   >>
 
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 12:41:54   
quote:

Page 3 has the following statement...
UPDATE DrvTable
SET DrvPswd=('::iDrvPswd::'),
DrvName=('::iDrvName::'),
DrvBio=('::iDrvBio::'),
DrvAward=(::iDrvAward::),
DrvPic=('::iDrvPic::')
WHERE ID=('::iID::')

Fantastic. But there is only one thing.... Now that you have a numeric field to refer too, you have to change the way numeric fields are inturpretted. VERY EASY.

WHERE ID= ::ID::

Text fields and Memos:
'::xxxx::'
Numerics:
::xxxx::

Like in:

UPDATE DrvTable SET DrvPswd=('::iDrvPswd::'), DrvName= ('::iDrvName::'), DrvBio=('::iDrvBio::'), DrvAward= ('::iDrvAward::'), DrvPic=('::iDrvPic::') WHERE ID=(::iID::)

Do you like brackets better? You can do it with or without. Make no difference.

UPDATE DrvTable Set (DrvNum= ‘::DrvNum::’, DrvPswd= ‘::DrvPswd::’, DrvBio= ‘::DrvBio::’, DrvAward= ‘::DrvAward::’, DrvPic= ‘::DrvPic::’ WHERE (ID = ::iID::)

Plus you were missing ' and ' around iDrvAward.

In the future, you can keep your form field names the same as your database table fields if that is easier.

ie: WHERE (ID = ::ID::)
This applies to any db and tbl fields. AGAIN, this doesn't really matter. You can leave it the way it is.


We're almost there!!! :)

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 16:30:30   
I have made the changes above...

Here is the statement now:

UPDATE DrvTable
SET DrvPswd='::DrvPswd::',
DrvName='::DrvName::',
DrvBio='::DrvBio::',
DrvAward='::DrvAward::',
DrvPic='::DrvPic::'
WHERE (ID=::ID::)

As you can see, I changed the names of my form fields to be the same as the database fields.

:) I am still getting that stupd message...

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 17:21:33   
Page two is pulling in the value for ID and transferring it to page 3 right?

We need to see what is coming in to page 3.
Place this (monitoring) ASP code on TOP of page 3 above the <html> tag:

<%
a = request.form ("DrvPswd")
b= request.form ("DrvName")
c= request.form ("DrvBio")
d= request.form ("DrvAward")
e= request.form ("DrvPic")
f= request.form ("ID")
response.write ("<BR>DrvPswd= " & a & "<BR>DrvName= " & b & "<BR>DrvBio= " & c & "<BR>DrvAward= " & d & "<BR>DrvPic= " & e & "<BR>ID =" & f)
%>


Now when you make it to page 3, you'll see the values that are being passed from page 2 to 3 on top of the page. Make sure each field is filled with something and that the info is correct.

Are you testing live on your site, or are you testing locally?
Maybe you better send me the error message again.

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 19:55:58   
I put those lines of code into page 3 and everything looked like it should. All the information I entered was transfered to that page.

The error message is...

Database Results Wizard Error
The operation failed. If this continues, please contact your server administrator.

I am testing it on the live site.

< Message edited by D_Sutter -- 10/28/2003 7:56:28 PM >

(in reply to Long Island Lune)
Spooky

 

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

 
RE: Updating Access DB from .asp Form - 10/28/2003 20:40:59   
There are many things that can cause that error - can you try FP > tools > web settings > database > verify connection?

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 21:41:49   
Everything verifies fine.

(in reply to Spooky)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 21:46:45   
Ahh.... You posted before I finished.

Did you import the database in, or create it inside the FP environment?

_____________________________

Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 21:47:52   
Is page 3 saved as an ASP page with an extension of .asp?

_____________________________


(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/28/2003 22:46:17   
quote:

Database Results Wizard Error
The operation failed. If this continues, please contact your server administrator.


When you put the query in the Qizard Dialog Box, did it verify correctly?

_____________________________


(in reply to Long Island Lune)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/29/2003 6:11:51   
I imported the database in after creating it in Access (office XP).

Page 3 is a ASP page.

The query verifies fine.

The only other thing that I can think of the help you find my problems is that I am in a sub-web. I have added all the database information to the main global.asa file (not in sub-web) and put my database in the main webs fpdb subdirectory. It obviously finds the database and information, but I wanted to let you know just in case there was something about it updating from there.

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/29/2003 12:51:28   
D,

I think you might be on to something. I've seen people have sub-web problems on the forum before. I don't touch them myself. So your database is in the the main but your pages are in the sub? Hmmm...

Maybe it might be wise to diet the DRW on page 3. Then you would have more control over the code. In the DRW code there is a line like this:

fp_sDataConn="DriverDBX"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0

I don't know if this would work but you could try changing that to:

fp_sDataConn="../fpdb/DriverDBX"

Don't bank on it. :)


To see IF all the work we did in this thread "does" work, you should remove the pages out of the subweb temporarily (or just make a copy) and put them in the main web, test the code to make sure it UPDATES your database correctly, then put it back KNOWING that it works and post another question on subwebs and their connections to main web databases.

That's what I would do. I would want to know that the code works before attempting to figure a solution to a new problem. (subwebbing)

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/29/2003 13:17:19   
:) OK! :)

Putting the pages in the main web and then trying it WORKED! Thank you very much for your help. I tried changing the information on page 3 as you said above and it still didn't work.

I did have one question though...
When it updated, it stayed on the asp (3) page and said "no records returned". Is there a way to not display this or display a page to let the user know the information has been updated?

I will continue the questions on the sub-web forum.

Thanks again!

< Message edited by D_Sutter -- 10/29/2003 1:18:33 PM >

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/29/2003 13:51:23   
I'm glad it worked. I thought I was going crazy there for a moment.

Question:
Once completed , the DRW will keep you on the same page. But it is hidden from public view. Many posts back -when I was showing you the method for using the DRW, I gave you these instructions:


1): Double-click your yellow Database Region on your page.
2): Click "Next" once. This will put you on page "Step 2 of 5".
3): Click "Custom Query".
4): Click "Edit" beneath "Custom Query".
5): Copy the query I provided you above.
6): Insert it in place of the query showing in the dialog box.
7): Click "Verify Query".
8): Click "OK".
9): Click "Next" until you get to page "Step 4 of 5".
10): Select "Table - one record per row".
11): Make sure NONE of the checkboxes are checked beneath.

12): Click "Next".
13): On page "Step 5 of 5", click "Display all records together".
14): On page "Step 5 of 5", unclick "Add search form".
15): Click "Finish".

Those actions (in RED above) were to HIDE the DRW from view on the page. On the page, (normally) you would put text for your visitor... some wording like: "Your account has been updated. click xxx below to go back to..." near the bottom of the page or something. That's what I do.

To HIDE the message that appears:

1): Double click your yellow DRW area.
2): Advance through to page: "STEP 3 of 5".
3): Click on the "MORE OPTIONS" button.
4): In the WHITE MESSAGE Field, REMOVE that line.
5): Proceed on to the end of the DRW STEPS.


Now the message won't appear each time an UPDATE has occurred.

:)

< Message edited by Long Island Lune -- 10/29/2003 1:52:52 PM >


_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 9:12:34   
Two final questions...

What does the query look like when you just want to add a record to the database?

Can you retrieve the system date and put it into a form field?

Thanks.

< Message edited by D_Sutter -- 10/30/2003 10:12:03 AM >

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 12:53:20   
Question 1: Adding a Record:
INSERT INTO DrvTable (DrvNum , DrvPswd, DrvBio, DrvAward, DrvPic) VALUES (‘::DrvNum::’, ‘::DrvPswd::’, ‘::DrvBio::’, ‘::DrvAward::’, ‘::DrvPic::’)

Question 2: Date in form-field
Sure. You would create another edit field in your form. You know how to do that right? Once you have the new field in your form - do this:

1): Double-click the new form field.
2): In the "Name" field give it a name: (ie: myDate).
3): In the "Initial Value" field place this: <%=Date()%>
4): Click OK.


Now the date will appear in your form field. And it will also be POSTED to page 3 if you should ever need to save it for some reason.

_____________________________


(in reply to D_Sutter)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 12:55:52   
One thing I forgot to mention:

When naming fields in your forms or database (for date types) - do not name your field Date. It is a reserved word in MS-ACCESS. That's why I gave you the example name"myDate" above.

_____________________________


(in reply to Long Island Lune)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 14:08:43   
That does the trick...

Is there anyway to make the date in MM/DD/YYYY format?

Don

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 14:16:58   
Do you mean something like this:

Full Day and Date:
<%=FormatDateTime(Date(), 1)%>


Or just the 4-digit year?

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 14:18:48   
I just want it to say...

10/30/2003

Don

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 14:34:45   
Don - try this:

<%=Month(Now)&"/"&Day(Now)&"/"&Year(Now) %>

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 14:37:13   
Works great! Thank you for all your help.

Don

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/30/2003 14:39:28   
Your Welcome.
CHEERS :)

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 9:53:13   
I did have another question...

Are the codings that you are giving me just html? I was wondering where I could get some information on some of these things...like date and formating output.

I am looking for a way to convert a number stored in my database (date in YYYYMMDD format) to display in a MM/DD/YYYY format.

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 12:43:15   
I used .ASP and VBScript in this thread. ASP was the code launching pad, but VBScript did most of the work. The date code I gave you was VBscript inside ASP. The DRW was a combination of HTML and ASP.

.ASP:
http://www.devguru.com/Technologies/asp/quickref/asp_list.html

VBScript:
http://www.devguru.com/Technologies/vbscript/quickref/vbscript_list.html

For your latest task, VBScript will be the one to use.
You want to convert UK dates to US?

Here's some poop on this but it will probably confuse you more than help:
http://www.aspfaq.com/show.asp?id=2260

Are ALL the dates people enter in your form in UK format?

_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 12:47:59   
I have all the dates going in as YYYYMMDD.

I just wanted to display them as MM/DD/YYYY.

Thank you for the links.

Don

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 12:48:07   
Maybe something like this:

myDate = year(Now) & left("00",2-len(month(now))) & month(Now) & left("00",2-len(day(Now))) & day(dt)

BUT..... This is assuming that ALL dates incoming are in UK format.

_____________________________


(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 12:50:14   
You want to DISPLAY them? In your DRW display page, or in the form? Where?

_____________________________


(in reply to Long Island Lune)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 12:53:11   
It reads the date out of the database in format YYYYMMDD. I just want it to be displayed in the DRW table as MM/DD/YYYY.

Where would I put a statement "myDate = " at? Where in the .asp page?

< Message edited by D_Sutter -- 10/31/2003 12:54:06 PM >

(in reply to Long Island Lune)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 13:07:35   
Correction:
The following code WILL take a yyyy/mm/dd format and convert it to a mm/dd/yyy format for you:

With / forward slashes embedded:
= mid (mtDate, 6, 2) & "/" & right (mtDate, 2) & "/" & left(mtDate, 4)


Without / forward slashes embedded:
= mid (mtDate, 6, 2) & right (mtDate, 2) & left(mtDate, 4)


I just tested it. It works. Disregard the first code I gave you 2-posts back.

This code will have to be placed in the DRW code by hand. Post your display code. Or you would have to go into your DRW code yourself, find the date display line and replace it with the code I just gave you. Just make sure to change "mtDate" in my code with the field from your database. If you can't figure it out, post the DRW display code.

< Message edited by Long Island Lune -- 10/31/2003 1:10:43 PM >


_____________________________


(in reply to D_Sutter)
D_Sutter

 

Posts: 48
Joined: 10/4/2002
Status: offline

 
RE: Updating Access DB from .asp Form - 10/31/2003 14:20:06   
Here is the DRW section...

I have changed the field like you posted and all I get is "//" for the date.

<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="SELECT * FROM NewsTable ORDER BY nwDate DESC"
fp_sDefault=""
fp_sNoRecords="No records returned."
fp_sDataConn="news"
fp_iMaxRecords=10
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="nwDate"
fp_sMenuValue="nwDate"
fp_sColTypes="&nwID=3&nwDate=3&nwNews=203&nwNum=202&nwDrv1=202&nwDrv2=202&nwDrv3=202&nwDrv4=202&nwDrv5=202&nwDrv6=202&"
fp_iDisplayCols=2
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" endspan --><table BORDER="0">
<tr>
<td valign="top"><font face="Lucida Sans" size="2">
<%=mid(nwDate, 6, 2) & "/" & right(nwDate, 2) & "/" & left(nwDate, 4)%></font></td>
<td><font face="Lucida Sans" size="2">
<%=FP_FieldVal(fp_rs,"nwNews")%></font></td>
</tr>
</table>
<hr>
<!--webbot bot="DatabaseRegionEnd" b-tableformat="FALSE" b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc" i-groupsize="0" clientside tag="BODY" preview="<table border=0 width="100%"><tr><td bgcolor="#FFFF00"><font color="#000000">This is the end of a Database Results region.</font></td></tr></table>" startspan --><!--#include file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" endspan --></td>

(in reply to Long Island Lune)
Page:   <<   < prev  1 [2] 3   next >   >>

All Forums >> Web Development >> ASP and Database >> RE: Updating Access DB from .asp Form
Page: <<   < prev  1 [2] 3   next >   >>
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