Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 30th, 2004, 07:18 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Establishing a database connection

I am trying to connect to a server DSN.

I have several questions:

1. Should I be able to see the DSN when I do a dir?
2. In the global.asa file you should have something like this:

<script language="vbscript" runat="server">
sub Application_OnStart
Application.Lock
Application("connstr") = "MYSITEDSN"

Application.Unlock
end sub

sub Application_OnEnd
end sub

sub Session_OnStart
end sub

sub Session_OnEnd
end sub
</script>

Above is the global.asa, where does it go and what else do I put in it? My database is in a directory called "database".

3.What does the following mean?

In your .ASP files that are connecting to the database, you should have something like this before the tag: Where "TableName" is the name of the table you are opening. And this after the closing tag:

<%
rs.close
conn.close
%>

4. In the e-mail that provided the above information, I was told that
I could remove the file level DSN from my website. I did not see anything that mentioned DSN. How do I remove it?

5. I will wait for responses before asking any more questions.

6. I have Professional Activer Server Pages 2.0 for a reference and I have looked for the answers. Point me in the right direction if what I need is in the book. I will keep reading it.

Thanks for any help.

Reply With Quote
  #2 (permalink)  
Old October 30th, 2004, 08:07 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I found a file .dsn in my root directory. I am guessing
that is the file level dsn mentioned in the post. Will
I be able to see the Server DSN?

All the other questions still stand.

Thanks


Reply With Quote
  #3 (permalink)  
Old October 31st, 2004, 11:35 PM
Friend of Wrox
Points: 6,384, Level: 34
Points: 6,384, Level: 34 Points: 6,384, Level: 34 Points: 6,384, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,823
Thanks: 12
Thanked 15 Times in 15 Posts
Send a message via AIM to mat41
Default

;;;1. Should I be able to see the DSN when I do a dir?
I do not believe so, you will see files and folders only

;;;2. In the global.asa file you should have something like this:
Not all sites need a global.asa file, you will need one if:
A..If you want to extend the session beyond its 20 minute default
B..Create a 'how many guests do I have surfing my site' variable using the alpplication object - amoung other reasons...
NOTE:There is to be no client-side script in the global.asa file. This file is only for the purpose of server-side scripts.

;;;Above is the global.asa, where does it go and what else do I put in it?
It MUST go in the root level of each web site 'that needs one' As for what else goes in it, have you asked google?

;;;3.What does the following mean?
In your .ASP files that are connecting to the database, you should have something like this before the tag: Where "TableName" is the name of the table you are opening. And this after the closing tag:
<%
rs.close
conn.close
%>

mmmm - "before the tag: Where TableName" - 'Where TableName' looks very much like part of an sql statement to me, cant help you on that one.

The following closes a record set named rs then closes the database connection, record sets and DB connections should be closed after use.
rs.close
conn.close

;;;I could remove the file level DSN from my website. I did not see anything that mentioned DSN. How do I remove it?
I wouldnt worry about this

TIP:
;;;I have Professional Activer Server Pages 2.0 for a reference
Splash out get the latest book for best results

Wind is your friend
Matt
Reply With Quote
  #4 (permalink)  
Old November 3rd, 2004, 10:56 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Mat,

Appreciate your help. I found some code for a guestbook
and got it to work on my server. Just need to move it
to my host.:D My daugter picked little happy faces for me.

Since the book I have is a loaner, I will invest in a more current
edition.;)



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Connection to Access Database reachsevar ASP.NET 2.0 Basics 1 November 28th, 2007 07:56 AM
Error establishing socket for SQL Connection. mcw22 Java Databases 0 March 19th, 2007 09:29 PM
Database connection Boris Kofman Visual Basic 2005 Basics 2 February 11th, 2007 03:14 PM
Database connection. tiennguyen Classic ASP Databases 2 September 30th, 2003 09:48 PM



All times are GMT -4. The time now is 12:25 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.