Trouble getting started with FP & Access

D

Dennis

I've managed to upload my website to my ISP which hosts it. I've also
uploaded my Access DB into the \fpdb sub-folder of the web site. Using the
Wizard at Insert >Database > Results, I've created an ASP page that shows
records from my DB on the web site. So far, so good. But, the display of
my DB is simplistic and I've read that if I want more subtlety, I'll need to
write some ASP code of my own.

So, I went out and bought a book on ASP, "Active Server Pages 3.0" by Paul
Whitehead. In the book, in the section titled "connecting to a database",
he shows a sequence that looks like this:
----------------------------------------------------------------------------
--------
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
ConnectionToDatabase.ConnectionTimeout=60
connectionToDatabase.Open "DNS=mydatabase"
....
connectionToDatabse.Close
Set connectionToDatabase=Nothing
----------------------------------------------------------------------------
--------
I read about the DNS (data source name) and it said that "The data source
name must be created on the Web server that stores the database and the ASP
pages that will access the database." This section was confusing to me as
it showed three DNS types (System, User and File) and it went on to say that
the administrator of the web server usually the type of DNS that must be
used.

Based on the above, I thought it must be time for me to pick up the phone
and call my ISP and ask for them to create a DNS for me that referred to my
Database's location on their system after I uploaded it. I actually tried
this and they were pretty clueless - almost as clueless as I was - about
what I wanted to do.

After I hung up, I realized that I shouldn't need to call my ISP to do this.
After all, the simplistic ASP code auto-generated by the Insert > Database >
Results Wizard had created everything necessary on this end earlier and all
I had to do was upload it to the ISP and go and it all worked without
needing the ISP to generate a DNS.

So, at that point, I started to look more closely at the code the Wizard
generated to see how it was doing the equivalent of the code block from the
book which I've shown above. And, I've looked and looked and I'm still
clueless.

First off, the Wizard created code in the global.asa file that looks like
this:
----------------------------------------------------------------------------
--------
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(1)
'--Project Data Connection
Application("MyWCWN_ConnectionString") = "DRIVER={Microsoft Access Driver
(*.mdb)};DBQ=URL=fpdb/WCWNdata_be.mdb"
FrontPage_UrlVars(0) = "MyWCWN_ConnectionString"
Application("MyWCWN_ConnectionTimeout") = 15
Application("MyWCWN_CommandTimeout") = 30
Application("MyWCWN_CursorLocation") = 3
Application("MyWCWN_RuntimeUserName") = ""
Application("MyWCWN_RuntimePassword") = ""
'--
Application("FrontPage_UrlVars") = FrontPage_UrlVars
'==FrontPage Generated - endspan==
End Sub
----------------------------------------------------------------------------
--------
This names my DB (MyWCWN) and describes where it is. Seems like it is
pretty close to doing what I want. Problem is that when I go over to the
ASP page where the database is actually displayed to see how it uses this
stuff, I find a lot of webbot code which I find inpenetrable.

I guess my question is (and pardon me if I am confused here) how to
translate from what FP has generated in the global.asa file to how the book
is telling me to open my database?

Or, maybe another way to ask the question is can I create a DNS as say a
file and upload it along with my website to the ISP host and then refer to
this file when I have to do the connectionToDatabase.Open "DNS=mydatabase"
step the books suggests?

I suspect I'm making this way too hard but I'm pretty confused at the
moment. If you know of a better book, a simle worked example or an on-line
tutorial, I'd love to hear about that too.
 
D

Dennis

Well, I figured it out with some help from a web site at
www.nextmill.net/databaseConnections.htm

The code that seems to work looks like this:

<%
DSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/fpdb/WCWNdata_be.mdb")
Response.Write("String = " & DSN ) ' this just shows me the string

Set myDB=Server.CreateObject("ADODB.Connection")
myDB.ConnectionTimeout=60
myDB.Open DSN
....
myDB.Close
Set myDB=Nothing
%>
 
X

xfile

Hi:

Thanks for the sharing and it will be useful for a beginner like me to do
some database.

But the link is broken.

Can you provide the right one??


Thanks!!!!
 
D

Dennis

http://www.nextmill.net/knowledge/databaseconnections.htm

Sorry, I left part of the address out. The above link should work.

--
Dennis Gallagher
Monroe, WA, USA


xfile said:
Hi:

Thanks for the sharing and it will be useful for a beginner like me to do
some database.

But the link is broken.

Can you provide the right one??


Thanks!!!!


Dennis said:
Well, I figured it out with some help from a web site at
www.nextmill.net/databaseConnections.htm

The code that seems to work looks like this:

<%
DSN="DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/fpdb/WCWNdata_be.mdb")
Response.Write("String = " & DSN ) ' this just shows me the string

Set myDB=Server.CreateObject("ADODB.Connection")
myDB.ConnectionTimeout=60
myDB.Open DSN
...
myDB.Close
Set myDB=Nothing
%>

--
Dennis Gallagher
Monroe, WA, USA

Dennis said:
I've managed to upload my website to my ISP which hosts it. I've also
uploaded my Access DB into the \fpdb sub-folder of the web site.
Using
the
Wizard at Insert >Database > Results, I've created an ASP page that shows
records from my DB on the web site. So far, so good. But, the
display
of
my DB is simplistic and I've read that if I want more subtlety, I'll
need
to
write some ASP code of my own.

So, I went out and bought a book on ASP, "Active Server Pages 3.0" by Paul
Whitehead. In the book, in the section titled "connecting to a database",
he shows a sequence that looks like this:

--------------------------------------------------------------------------
--
--------
Set connectionToDatabase=Server.CreateObject("ADODB.Connection")
ConnectionToDatabase.ConnectionTimeout=60
connectionToDatabase.Open "DNS=mydatabase"
...
connectionToDatabse.Close
Set connectionToDatabase=Nothing

-------------------------------------------------------------------------- the
ASP
pages that will access the database." This section was confusing to
me
as say
that to
my and
all from
the
refer
 
X

xfile

Hi:

THANKS and sure will spend time to study it!!!

:)

Dennis said:
http://www.nextmill.net/knowledge/databaseconnections.htm

Sorry, I left part of the address out. The above link should work.

--
Dennis Gallagher
Monroe, WA, USA


xfile said:
Hi:

Thanks for the sharing and it will be useful for a beginner like me to do
some database.

But the link is broken.

Can you provide the right one??


Thanks!!!!


by
Paul
must
referred
to
my
Database's location on their system after I uploaded it. I actually tried
this and they were pretty clueless - almost as clueless as I was - about
what I wanted to do.

After I hung up, I realized that I shouldn't need to call my ISP to do
this.
After all, the simplistic ASP code auto-generated by the Insert > Database

Results Wizard had created everything necessary on this end earlier and
all
I had to do was upload it to the ISP and go and it all worked without
needing the ISP to generate a DNS.

So, at that point, I started to look more closely at the code the Wizard
generated to see how it was doing the equivalent of the code block from
the
book which I've shown above. And, I've looked and looked and I'm still
clueless.

First off, the Wizard created code in the global.asa file that looks like

--------------------------------------------------------------------------
--
--------
Sub Application_OnStart
'==FrontPage Generated - startspan==
Dim FrontPage_UrlVars(1)
'--Project Data Connection
Application("MyWCWN_ConnectionString") = "DRIVER={Microsoft Access
Driver
(*.mdb)};DBQ=URL=fpdb/WCWNdata_be.mdb"
FrontPage_UrlVars(0) = "MyWCWN_ConnectionString"
Application("MyWCWN_ConnectionTimeout") = 15
Application("MyWCWN_CommandTimeout") = 30
Application("MyWCWN_CursorLocation") = 3
Application("MyWCWN_RuntimeUserName") = ""
Application("MyWCWN_RuntimePassword") = ""
'--
Application("FrontPage_UrlVars") = FrontPage_UrlVars
'==FrontPage Generated - endspan==
End Sub

-------------------------------------------------------------------------- to
the
ASP page where the database is actually displayed to see how it uses this
stuff, I find a lot of webbot code which I find inpenetrable.

I guess my question is (and pardon me if I am confused here) how to
translate from what FP has generated in the global.asa file to how the
book
is telling me to open my database?

Or, maybe another way to ask the question is can I create a DNS as
say
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top