Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language 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 Search this Thread Display Modes
  #1 (permalink)  
Old March 1st, 2006, 07:43 AM
Authorized User
 
Join Date: Nov 2005
Location: , , Spain.
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
Default Is coded needed on every page?

Hi,

I have several ASp pages which need to call the SQL server.
Do I need to put on every ASP page the next code?

In the begin of the page:
===
Set conn = server.createobject("adodb.connection")
conn.open "DSN=FARMA"
set rs = server.createobject("adodb.recordset")
===


At the end after the SQL is executed
===
rs.Close
Conn.Close
Set rs=Nothing
Set Conn=Nothing
===

Or is it better to put it into an .INC file and just include it
in the beginning?

I am asking this because I have the code everytime I do an SQL sequence to get data from th DB, but I guess it is slowing down the speed of the pages when you want to see them, correct?

Please push me in the right direction,

David


Reply With Quote
  #2 (permalink)  
Old March 1st, 2006, 06:53 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;Do I need to put on every ASP page the next code?
yes, on every page you need a connection. and yes if you open a connection you should close it when you have finished with it.

;;;Or is it better to put it into an .INC file and just include it
in the beginning
I place code in an include file that gets used in many places BUT more importantly code that you may want to change (has constants or variables etc) of course changing an incluse file changes it in all area were it is used - therefore yeah why not.

;;I am asking this because I have the code everytime I do an SQL sequence to get data from th DB
If you need a connection you need the connection code, so of course you are

;;but I guess it is slowing down the speed of the pages when you want to see them, correct?
No. weather the code is in an include file or in line its not going to effect your pages performance. As I said if you need a connection, you need the connection code.

HTH

Wind is your friend
Matt
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Hard coded paths pauliehaha Classic ASP Professional 8 February 6th, 2007 06:48 PM
Hard coded examples etrump BOOK: Professional Ajax ISBN: 978-0-471-77778-6 1 March 1st, 2006 02:10 PM
C# Help needed in aspx page savoym ASP.NET 1.0 and 1.1 Basics 3 January 28th, 2005 02:34 PM
The solution hard coded "ThePhile" jackchua BOOK: ASP.NET Website Programming Problem-Design-Solution 3 October 20th, 2004 11:25 PM



All times are GMT -4. The time now is 06:23 AM.


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