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

 

ASP pages

 
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 >> ASP pages
Page: [1]
 
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
ASP pages - 7/11/2002 9:34:19   
Is it possible to use the .asp page generated by frontpage to directly update the source database table for that page?

I have a database of names and addresses that i need to be able to update via a web page.
I have used the frontpage database results wizard to display the information in text boxes on a web page but now need to be able to amend that data within the text boxes and write it back to the same table in the database.

Any suggestions would be great.

Thanks in advance:)



_____________________________

Toolman
" ....It was like that when I got Here!"
rdouglass

 

Posts: 9227
From: Biddeford, ME USA
Status: offline

 
RE: ASP pages - 7/11/2002 10:33:03   
Not in it' s ' native' form. You can however create a second page (using the DRW) and put in a custom script (for updating) on that second page. Once the update is done, you can redirect back to the first page. You can see the update instructions here:

http://www.outfront.net/spooky/update.htm

To do it all on the same page (at least AFAIK), you' ll have to do some custom ASP scripting.

(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/12/2002 6:57:38   
rdouglass

Thanks for the reply
I have taken a look at the instructions.
Unfortunately I cannot get it to connect to the database with the SQL code quoted on the web page (suitably modified to look at my own table headings).
I assume that this code is inserted in the second page of the wizard under the ' custom query' button or have I lost the plot completely:)

Cheers


_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Eli

 

Posts: 2658
From: ... er ...
Status: offline

 
RE: ASP pages - 7/12/2002 11:22:14   
post your code and we' ll see whats up

< Message edited by Micah -- 7/11/2002 11:22:30 AM >

(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/12/2002 12:02:03   
Micah
Here goes.
I have managed to create a connection to the database using the wizard and the custom script that rdouglas suggested however it will not update the database table.

The code for the asp page is as follows:


<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>Cost</title>
</head>

<body>

<form BOTID=" 0" METHOD=" POST" ACTION=" orange_update.asp" >
<table BORDER=" 0" >
<tr>
<td><b>Cost_centre</b></td>
<td><input TYPE=" TEXT" NAME=" Cost_centre" VALUE=" <%=Request(" Cost_centre" )%>" size=" 20" ></td>
</tr>
<tr>
<td><b>ID</b></td>
<td><input TYPE=" TEXT" NAME=" ID" VALUE=" <%=Request(" ID" )%>" size=" 20" ></td>
</tr>
</table>
<br>
<input TYPE=" Submit" ><input TYPE=" Reset" ><!--webbot bot=" SaveAsASP" CLIENTSIDE
SuggestedExt=" asp" PREVIEW=" " -->
<p> </p>
</form>
<table width=" 100%" border=" 1" >
<thead>
</thead>
<tbody>
<!--webbot bot=" DatabaseRegionStart" startspan s-columnnames s-columntypes
s-dataconnection=" orangebilling" b-tableformat=" TRUE" b-menuformat=" FALSE"
s-menuchoice s-menuvalue b-tableborder=" TRUE" b-tableexpand=" TRUE"
b-tableheader=" TRUE" b-listlabels=" TRUE" b-listseparator=" TRUE"
i-ListFormat=" 0" b-makeform=" TRUE" s-recordsource s-displaycolumns
s-criteria s-order
s-sql=" UPDATE Cost_Centre<br>Set Field =' ::Cost_centre::' <br>WHERE ID=' ::ID::' "
b-procedure=" FALSE" clientside SuggestedExt=" asp"
s-DefaultFields=" Cost_centre=&amp;ID="
s-NoRecordsFound=" No records returned." i-MaxRecords=" 256" i-GroupSize=" 5"
BOTID=" 0" u-dblib=" _fpclass/fpdblib.inc" u-dbrgn1=" _fpclass/fpdbrgn1.inc"
u-dbrgn2=" _fpclass/fpdbrgn2.inc" tag=" TBODY"
local_preview=" <tr><td colspan=64 bgcolor=" #FFFF00" align=" left" width=" 100%" ><font color=" #000000" >Database Results regions will not preview unless this page is fetched from a Web server with a web browser. The following table row will repeat once for every record returned by the query.</font></td></tr>"
preview=" <tr><td colspan=64 bgcolor=" #FFFF00" align=" left" width=" 100%" ><font color=" #000000" >This is the start of a Database Results region. The page must be fetched from a web server with a web browser to display correctly; the current web is stored on your local disk or network.</font></td></tr>"
b-WasTableFormat=" TRUE" --><!--#include file=" _fpclass/fpdblib.inc" -->
<%
fp_sQry=" UPDATE Cost_Centre Set Field =' ::Cost_centre::' WHERE ID=' ::ID::' "
fp_sDefault=" Cost_centre=&ID="
fp_sNoRecords=" <tr><td colspan=16 align=left width=" " 100%" " >No records returned.</td></tr>"
fp_sDataConn=" orangebilling"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=5
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=" "
fp_sMenuValue=" "
fp_iDisplayCols=16
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file=" _fpclass/fpdbrgn1.inc" -->
<!--webbot bot=" DatabaseRegionStart" i-CheckSum=" 59263" endspan -->
<!--webbot bot=" DatabaseRegionEnd" startspan b-tableformat=" TRUE"
b-menuformat=" FALSE" u-dbrgn2=" _fpclass/fpdbrgn2.inc" i-groupsize=" 5"
clientside tag=" TBODY"
local_preview=" <tr><td colspan=64 bgcolor=" #FFFF00" align=" left" width=" 100%" ><font color=" #000000" >This is the end of a Database Results region.</font></td></tr><TR><TD ALIGN=LEFT VALIGN=MIDDLE COLSPAN=64><FORM><NOBR><INPUT TYPE=Button VALUE=" |< " ><INPUT TYPE=Button VALUE=" < " ><INPUT TYPE=Button VALUE=" > " ><INPUT TYPE=Button VALUE=" >| " > [1/5]</NOBR></FORM></td></tr>"
preview=" <tr><td colspan=64 bgcolor=" #FFFF00" align=" left" width=" 100%" ><font color=" #000000" >This is the end of a Database Results region.</font></td></tr><TR><TD ALIGN=LEFT VALIGN=MIDDLE COLSPAN=64><NOBR><INPUT TYPE=Button VALUE=" |< " ><INPUT TYPE=Button VALUE=" < " ><INPUT TYPE=Button VALUE=" > " ><INPUT TYPE=Button VALUE=" >| " > [1/5]</NOBR><BR></td></tr>" --><!--#include file=" _fpclass/fpdbrgn2.inc" -->
<!--webbot bot=" DatabaseRegionEnd" i-CheckSum=" 62730" endspan -->
</tbody>
</table>

</body>

</html>


Thanks for taking the time to look:)





_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: ASP pages - 7/12/2002 19:20:20   
I assume " ID" is numeric.
If so, then youll need to use :

 .... where ID = ::ID:: 


Numerics do not require the extra quotes as text do.

_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/13/2002 3:20:23   
Spooky
Thanks for the suggestion.
I have tried this both with and without the quotes.
I am getting the following error message on the web page when I try to run it :-



Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Number: -2147217904 (0x80040E10)
Source: Microsoft OLE DB Provider for ODBC Drivers


Cheers:)


_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: ASP pages - 7/13/2002 8:11:17   
When you view the page, is the text box populated?

<input TYPE=" TEXT" NAME=" ID" VALUE=" <%=Request(" ID" )%>" size=" 20" >

If not, what is the link you use to get to this page?

_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/13/2002 8:34:25   
Spooky
Are you saying that I have to pass the data from another asp page to this one to populate the fields before I amend them and pass them to the database table?

This page when opened has empty text boxes. and an error mesage as follows:-


Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression ' ID=' .
Number: -2147217900 (0x80040E14)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.



Sorry to appear stupid but I am new to this and have very little HTML experience.

Many thanks:)

_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: RE: ASP pages - 7/13/2002 8:47:50   
Ok, try this !

After the </form> tag, add this code :

</form>  
[color=red]<%If request(" ID" ) <> " "  then%>[/color]
 ....etc 

</table> 
[color=red]<%End if%>[/color]
</body> 



< Message edited by Spooky -- 7/12/2002 8:48:49 AM >


_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/13/2002 9:14:38   
Spooky
No change except that the text ....etc appears above the error box.:)

Cheers

_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: ASP pages - 7/13/2002 12:02:55   
" ....etc" represents your code from the code you pasted above - you did include that?

You have used a query " where ID = ::ID::" ?

_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/15/2002 10:32:42   
Duh!
I seeeeee!
Like I said

quote:

Sorry to appear stupid but I am new to this and have very little HTML experience.


Ill give it another go.

Many thanks:)

_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/15/2002 10:42:53   
Spooky
Progress made!
The page no longer opens with an error but I still get the following when submitting the change to the database:-

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Number: -2147217904 (0x80040E10)
Source: Microsoft OLE DB Provider for ODBC Drivers

Do you know of an available example database and web pages that I can use as a basis for getting round my problem.
Perhaps if I can see one in action I can figure out where I am going wrong

Many thanks for your continued help:)



_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: ASP pages - 7/15/2002 22:00:16   
Are the input boxes filled when you press submit?

_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/16/2002 2:37:27   
Spooky
Yes I enter the new value and click submit.
This gives the error message above.
I have checked that the ID I am using is in the database table.

Cheers:)

_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: ASP pages - 7/16/2002 2:53:24   
Do you have an example URL perhaps? or how does the actual SQL string you use now look?

_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/16/2002 3:11:06   
No URL I' m afraid - this is for an intranet site and I am publishing this one to a test server at the side of my desk.

The SQL for this page is as follows:

UPDATE Cost_Centre
Set Field =' ::Cost_centre::'
WHERE ID=::ID::

Thanks for the continuing support:)

_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
Spooky

 

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

 
RE: ASP pages - 7/17/2002 15:29:29   
With the code on a diet, can you change this code?

<% 
fp_sQry=" UPDATE Cost_Centre Set Field =' ::Cost_centre::'  WHERE ID=' ::ID::' "  
[color=#CC0000]Response.write fp_sQry
Response.end
[/color]
fp_sDefault=" Cost_centre=&ID="  


What is the result?

_____________________________

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

§þ:)


(in reply to Toolman)
Toolman

 

Posts: 203
Joined: 3/14/2002
From: United Kingdom
Status: offline

 
RE: ASP pages - 7/19/2002 4:06:54   
Spooky
Sorry dont have time to try this at the moment as I am going on holiday for a fortnight.
I will try this when I get back and post the reply.

Many thanks:)

_____________________________

Toolman
" ....It was like that when I got Here!"

(in reply to Toolman)
johnhbonds

 

Posts: 1
Joined: 6/17/2003
Status: offline

 
ASP pages - 6/17/2003 18:04:22   
:)HOW WOULD I ENCOMPASS A FUNCTION IN MY ASP TO HAVE THE BACKGROUD OF A CELL IN A TABLE TO CHANGE COLORS, BASED ON IF THE COLOR IS NAMED ' G' FROM A COLUMN IN TABLE.

IF that isnt clear, I want the background to change green if G is the value on my table, yellow if Y is and so forth.

The tables name is projdate.


Thanks:)

(in reply to Toolman)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> ASP pages
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