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

 

Form input on ASP page to Access database?

 
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 >> Form input on ASP page to Access database?
Page: [1]
 
GW

 

Posts: 13
From: None
Status: offline

 
Form input on ASP page to Access database? - 3/7/2001 13:34:00   
I'm trying to have a form input into an Access database table on the web server of the hosting company. It doesn't work. I am new to this but the steps seem logical.


Here is what I've done:

1) Created the DSN name on the hosting company's web server for Access. According to their automated control panel once you submit DSN name & name of the database, "it should be available immediately for use."

2) Created the Access database and FTP'd to the directory indicated by the hosting company. According to the hosting company's FAQ "Your absolute path is d:/html/users/(yourdomaincom)/html." According to the automated control process DSN setup "create a directory called 'database' at the SAME level as your 'html' directory. This director cannot be inside the 'html' directory. This will ensure that your database has the prorper permissions on it..." So I created a directory with a FTP program with an absolute path of "d:/html/users/(yourdomaincom)/database" which is at the same level as the absolute path. I am a little fuzzy here but the server side DSN must point to this directory.

3) Created a system DSN name on the System DSN tab in the OBDC Data Source (32 bit) of the Control Panel of my PC. I'm not sure of the process here, but somehow the ASP page when creating it has to know to use the 'DSN name' I defined on hosting companies web
server. I used the same DSN name on my PC as I defined on the web server at the hosting company. It makes sense that this would be necessary when creating the form to tell FP2k how to link the code between the form fields text boxes to the fields in the Access database.

4) Created the ASP Web Page in FP2k which inputs to a database. It was on the options tab that I linked the form fields to the database fields, defined the database connection, and the table to hold the results.

I am not sure if you can check this locally, but I just did anyway. In the bar of the page window it states "This page contains elements that may need to be saved or published to preview correctly." In the page window it states "The page cannot be displayed." The rest looks like the famous 404 error but at the bottom reads "Cannot find server or DNS Error." If you can check locally, I suspect what causes this is my
problem. This is where the logic is a little fuzzy to me. I set up a system DSN on my PC. Most if not all visitors are not going to have a DSN setup locally with the correct name. I would think it would have to be all server side processing. As I stated previously according to the hosting company the DSN is set up immediately for all Access databases when I enter the DSN name and name of the database file. Based upon the results of setting up the server side DSN, I am assuming it is OK. The strange thing is in FP2k it can check the DSN local connection when you set it up and
it was fine. Like I said this is the fuzzy part.

I must have missed something here. Any ideals would be appreciated. Thanks!

------------------
GW

Spooky

 

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

 
RE: Form input on ASP page to Access database? - 3/7/2001 15:12:00   
I think you are going a little wrong at step 3.

The DSN and code are all server side.
You dont need to do anything locally UNLESS you plan on developing on your PC using the same DSN as you will on your web.

All of your code that you upload or edit live on the server will refer to the DSN name as the connection.

Your DSN must point to bothe the directory and database name (it sounds as if you got that right?)

What code are you testing and how are you currently editing?

FP2000 DRW's? Custom ASP code?

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/7/2001 17:39:00   
Again I'm new to this, so hope you will be patient. You did re-inforce my thoughts on the server side regarding the DSN and pointer (i.e. code) to the Access database.

You bring up some points which I thought about, but was not sure on how to approach. This may be just semantics, then maybe not. First my objective is simly have the web pages on the host's server. I was going to just develop on my PC then upload to web. There is a problem here though. I think in terms of the old DOS directory tree when thinking of paths or URL's of a web site. I'm sure there are flaws in this concept, but the directory/path of the database is at the same level as the absolute path of the domain. See my item #2 on 1st post. Unless I'm missing something here FP2k through the user interface can NOT see outside (i.e. next to or below/higher depending on how you look at it whether the tree is upside down or right side up) the web path/directory which is open. What this issue was telling me was what I believe you are trying to tell me which is I would have to edit live. I tried this with FP2k and for some reason couldn't make the connection.

I've never done this before so I'm probably missing some steps. I use a dial up connection. I am trying WS_FTP Pro for FTP'ing, but have only used FP2k's publishing program. I just got FP2k a few months ago. When I try to make a direct connection to the web site I receive a message which reads "Could not find a web server at 'DOMAINxxx.com' on port 80. Please check to make sure that the web server name is valid and your proxy settings are set correctly. If you are sure everything is correct, the web server may be temporarily out of service." Do I need to use the FTP program for FP2k to work from the web? Probably not, but I am not sure.

You point out the DSN must point to both the directory and database. See items #1 & #2 on original post. I create the DSN name and named the database in the hosting company's automated control panel. I am assuming it works properly.

I am testing to see if the data I put into the form makes it to the Access table. It did not test successfully either from the web or on my PC. On my PC there was an error message, see large paragraph after item #4 on original post. When I tested on the web there was no error message and the results page opened up.

What is DRW's?

I haven't written any custom code. I did look at the html written by FP2k. I can follow the logic on the code FP2k wrote and it seems logical, but again I'm new here so it is most likely I am buying lunch here. Meaning: THIS IS THE PROBLEM!

-------------------------------------------
Here is the html code on the form:

<form method="POST" action="--WEBBOT-SELF--" name="Contact" onSubmit="">
<!--webbot bot="SaveDatabase" startspan SuggestedExt="asp"
U-ASP-Include-Url="_fpclass/fpdbform.inc" S-DataConnection="contact"
S-RecordSource="contact" U-Confirmation-Url="results/results.asp"
S-Form-Fields="S1 T2 T3 T4 T5 T1"
S-Form-DBFields="comments lname co_name email telephone fname" --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.inc"--><!--webbot
bot="SaveDatabase" endspan -->
<p>First
Name:            <input type="text" name="T1" size="20">   
Last Name:    <input type="text" name="T2" size="20"><br>
Company Name:    <input type="text" name="T3" size="56"><br>
Email Address:       <input type="text" name="T4" size="56"><br>
Telephone:            
<input type="text" name="T5" size="56"><br>
Comments:            
<textarea rows="2" name="S1" cols="48"></textarea><br>
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

--------------------------------------------

Here is the ASP code generated by FP2K:

<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.
On Error Resume Next

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("contact_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "contact", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(6)
Dim arFormDBFields0(6)

arFormFields0(0) = "S1"
arFormDBFields0(0) = "comments"
arFormFields0(1) = "T2"
arFormDBFields0(1) = "lname"
arFormFields0(2) = "T3"
arFormDBFields0(2) = "co_name"
arFormFields0(3) = "T4"
arFormDBFields0(3) = "email"
arFormFields0(4) = "T5"
arFormDBFields0(4) = "telephone"
arFormFields0(5) = "T1"
arFormDBFields0(5) = "fname"

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Response.Redirect "results/results.asp"

End If
End If

%>
---------------------------------------------


If you could help. Thanks!

------------------
GW


(in reply to GW)
Spooky

 

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

 
RE: Form input on ASP page to Access database? - 3/7/2001 20:39:00   
I think therein lies the problem, it is best to use the publish feature when using the DRW (Database results wizard) of FP2000. (Or open your site live)

Now, if your host supports FP, then the web site SHOULD be able to be oppened with FP

File > Open Web > http://www.yourweb.com

Dont use FTP as all the required files should be added / created by FP.

Now with your web open, attempt the same simple form you have below - typing in the DSN name as the source.

Check also, my info in the link below about the DRW

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/8/2001 20:28:00   
I open page live from web. Great, I must have done something wrong last night. When I use the DRW or Page Properties to set up link. I can see the DSN out on the server, but I get a connection error. It reads "The server encountered an error while processing a database request. For more information click Details. The details read "Server error: Unable to retrieve the list of record sources from a database using the connection string:

DSN=Contact;DRIVER={Microsoft Access Driver (*.mdb)}.

The following error message comes from the database driver software; it may appear in a different language depending on how the driver is configured.
-------------------------------------------------------


Source: ADO
Number: -2146824584 (0x800a0e78)"

I received an email form the hosting company which states I need to add connection string and a close string. It looks very similar to FP2k's ASP code, so I think something else is going wrong. The error looks like an Access Data Object. I tried to set table up, but couldn't type it in nor did FP2k see any table when I chose the tab to scroll.

Any ideals? I'll inquire to the hosting company also. Thanks

------------------
GW


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/8/2001 20:56:00   
I found ADO on ASP reference page on web, but couldn't find what the acronym actually means. I doubt ADO is Access Data Object but I'm sure I'll find out soon. Thanks for the help!

------------------
GW


(in reply to GW)
Spooky

 

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

 
RE: Form input on ASP page to Access database? - 3/8/2001 20:56:00   
With your web open live, can you do : Tools > Web settings > Database > Add / verify the connection for "Contact" ?

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/8/2001 20:46:00   
Yes, I can verify. Status is green check. I did that last night. I should have mentioned it in my last post. Sorry! Thanks for the help!

------------------
GW


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/8/2001 20:45:00   
I got it to work!

First, I took your advice and let FP2K write all code rather than try to insert code per support email from hosting company. Basically, I started from scratch with page.

1) Created a local System DSN with same name as the one on the hosting company's server and linked it to the same local database that is FTP'd to server. Locally I used the same directory structure as what exists on server.

2) Created a form in a page which used the local system DSN to link to table and fields in Accesss Database.

3) Deleted local System DSN.

4) Published entire site to server using FP2K.

5) Went to site and tested form with test data, then FTP'd database to my PC and saw test data in table.

Since I'm new to this, your help did eliminate a lot of the issues. Thanks for the help, Spooky!

------------------
GW


(in reply to GW)
Richard Knight

 

Posts: 48
From: France
Status: offline

 
RE: Form input on ASP page to Access database? - 3/12/2001 20:39:00   
OK....what is DSN? I have a feeling that you're issue is similar to mine, however, I've no idea what DNS means...and I suspect I need to!

Can someone explain?

Thanks,

Richard


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/13/2001 20:32:00   
DSN = Data Source Name

You need to set up a DSN to access a database on a web site. The DSN uses a driver. I am no expert here and am learning. I used it to write to an Access database from a form input on a web page.

I had to create the DSN locally to write the web page locally with FP2k, so FP2K could write the ASP code. I then had to create the DSN with the same name on the web hosting company's server, so once the page was published on the web it could access the database on the web site.

Hope that helps.

------------------
GW


(in reply to GW)
Vince from Spain

 

Posts: 658
From: Madrid Spain
Status: offline

 
RE: Form input on ASP page to Access database? - 3/13/2001 20:02:00   
Well yes . . . .
And no . . .

You do need to have a connection to your database, but it doesn't necessarily have to be a Data Source Name (DSN).

For instance, if you have a look in FP under tools -> web configuration -> Database . . .
Try adding a new database connection. The second option "system data source" is your DSN connection. The first one "Directory or file from the web" however uses an ODBC connection.

A lot of people prefer these ODBC connections as you end up with a "relative" connection to your database. For instance if your database is in mylocalweb/fpdb/mydatabase.mdb the connection is to fpdb/mydatabase.mdb
Now you publish to www.myrealweb.com and the database can still be found in the relative path fpdb/mydatabase.mdb so no need to change or recreate the connection.
Another reason that people like them is that you do not have to get your host involved like you do to set up a DSN.
And if that were not all, there seems to be a lot of evidence coming out that ODBC is a faster connection than a DSN. And when you get to use OLE DB, faster still.

------------------
Internet Business Solutions S.L.(Spain)


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/13/2001 20:13:00   
Like I said I'm new in this area and want to learn, so I have a question regarding Vince's valued reply.

If you choose the first option "Directory or file from the web" which uses an ODBC connection, are you not assuming the visitor to the web site (or client) has the ODBC driver installed on their computer?

If you use a DSN on the host, is the connection to the database by the visitor assured?

Do these options exist partially due to the answers of my 1st 2 questions?

Thanks!

------------------
GW


(in reply to GW)
Vince from Spain

 

Posts: 658
From: Madrid Spain
Status: offline

 
RE: Form input on ASP page to Access database? - 3/13/2001 20:43:00   
Hi There,
it is the web server that needs to have the drivers installed, not the person viewing the web page. The same is true of the DSN method, the DSN needs to be set up on the server, and no person viewing the page needs worry about it.

All the "client" will ever see is plain HTML, which is the great thing about a "server side" system like Active Server Pages (ASP) etc.

All the best

Vince

------------------
Internet Business Solutions S.L.(Spain)


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/13/2001 15:22:00   
So both DSN and driver are server side, that is interesting and GOOD.

Questions:
1) When an ASP page either "write to" or "reads from" a database on a host, is it best to write the page live on host?

2) The host I'm working with has you set a path outside the absolute path of your web site. They ask you to call the path "database." Through there control panel you provide (a) DSN name and (b) database name. I'm sure this sets up the pointer to the database file. Since I've never done the ODBC method, how is the pointer set up to the file?

3) With the ODBC method can you point to a database file outside the absolute path of youR site with FP2k?

Thanks!

------------------
GW


(in reply to GW)
dabney7

 

Posts: 8
From: Indianapolis, IN
Status: offline

 
RE: Form input on ASP page to Access database? - 3/13/2001 19:06:00   
I am by no means an expert-- just having fun with FP but I have had good results using a "DSN-LESS" connection by first copying the database then doing a past into FP2000-- it creates all the connections for you. I am not sure of all the up or downsides of doing this but it doesn't require you to keep asking your service provider to create DSNs for you. Here are a couple of articles that might be worth looking at http://www.4guysfromrolla.com/webtech/070399-1.shtml
http://www.powerasp.com/content/database/dsn_vs_dnsless.asp

Good luck


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/15/2001 17:27:00   
Can you use a DSN-less connection to a database if the database file is outside of the absolute path of the domain name on a host server?

Example Absolute Path:
d:/html/users/(yourdomaincom)/html

Path to database file:
d:/html/users/(yourdomaincom)/database

If yes what URL would you place in the dialog box "Database File in Current Web" URL text box?

It just doesn't seem doable because of FP2k doesn't let you see files outside of the current web.

Your thoughts, please! Thanks!

------------------
GW


(in reply to GW)
Spooky

 

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

 
RE: Form input on ASP page to Access database? - 3/15/2001 23:18:00   
You would need to manually edit the connection in the global.asa file, or ask your host for a DSN pointting to that database.

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to GW)
GW

 

Posts: 13
From: None
Status: offline

 
RE: Form input on ASP page to Access database? - 3/15/2001 23:49:00   
In the global.asa file do just put the server path to the file rather than a URL?


If yes, base upon my previous post it would be the following:

Path to database file:
d:/html/users/(yourdomaincom)/database

I'll just have to give it a try! I'll let you know if it works. Thanks!

------------------
GW


(in reply to GW)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Form input on ASP page to Access database?
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