473,545 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connection string declarations

I'm using a connection string in my asp pages similar to:

cst = "Provider=SQLOL EDB;Server=MySe rverName;Databa se=MyDbName;"
cst = cst & "Network Library=DBMSSOC N;User ID=MyUserid;Pas sword=MyPass"
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open cst

Do I need to declare the cst and conn variables?

ie:

dim cst
cst = "Provider=SQLOL EDB;Server=MySe rverName;Databa se=MyDbName;"
cst = cst & "Network Library=DBMSSOC N;User ID=MyUserid;Pas sword=MyPass"

dim conn
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open cst

Thanks
Jul 19 '05 #1
2 10540
Check this out and then decide (it *is* optional but recommended to declare
variables and use 'Option Explicit').

http://www.4guysfromrolla.com/webtec...ate/faq6.shtml

Chris.

"Luis" <an****@webmail .co.za> wrote in message
news:69******** *************** ***@posting.goo gle.com...
I'm using a connection string in my asp pages similar to:

cst = "Provider=SQLOL EDB;Server=MySe rverName;Databa se=MyDbName;"
cst = cst & "Network Library=DBMSSOC N;User ID=MyUserid;Pas sword=MyPass"
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open cst

Do I need to declare the cst and conn variables?

ie:

dim cst
cst = "Provider=SQLOL EDB;Server=MySe rverName;Databa se=MyDbName;"
cst = cst & "Network Library=DBMSSOC N;User ID=MyUserid;Pas sword=MyPass"

dim conn
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open cst

Thanks
Jul 19 '05 #2
-----Original Message-----
I'm using a connection string in my asp pages similar to:

cst = "Provider=SQLOL EDB;Server=MySe rverName;Databa se=MyDbName;
"cst = cst & "Network Library=DBMSSOC N;User ID=MyUserid;Pas sword=MyPass"set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open cst

Do I need to declare the cst and conn variables?

ie:

dim cst
cst = "Provider=SQLOL EDB;Server=MySe rverName;Databa se=MyDbName;
"cst = cst & "Network Library=DBMSSOC N;User ID=MyUserid;Pas sword=MyPass"
dim conn
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open cst

Thanks
.

I dont bother creating a connection string variable at all
unless I intend to use it twice, so you could get away
with -
Set conn = Server.CreateOb ject("ADODB.Con nection")
conn.open "Provider=SQLOL EDB;Server=MySe rverName;Databa se=M
yDbName;Network Library=DBMSSOC N;User
ID=MyUserid;Pas sword=MyPass"

HTH,

Colin
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3458
by: Chris Connett | last post by:
I have an interesting problem with eval(). ---Background Info--- The program I'm working on launches a separate process with a popen to do some highly specialized processing of input, then this process leaves resultant data structured in files, in python syntax, at a known absolute path, which is then read in, eval()'ed, and processed...
10
8149
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is effectively impossible to forward declare std::string. (Yes I am aware that some libraries have a string_fwd.h header, but this is not portable.) That...
3
26082
by: tperovic | last post by:
Hi, I have an application that uses ADO & VBA to connect to SQL Server 2000 periodically like this: Dim conn As ADODB.Connection Set conn = New ADODB.Connection conn.ConnectionTimeout = 1 conn.ConnectionString = "Provider=SQLOLEDB;Server=MyServer;Database=MyDatabase;UID=MyUserID;PWD=MyPa
10
3439
by: Lars Netzel | last post by:
Hi! Is it possible to start a dial-up connection that is already created on the computer thru VB.NET, and then after it has dialed up get an idication of that there's a connection ( I guess ping some server?) and then send a mail and close the conenction? I really need some pointers in where to start to look for this! best regards
5
6751
by: Frank Rizzo | last post by:
This is driving me nuts. I call the InternetDial API to open a dial-up connection and it just returns 0 (success) without actually making a call. Am I missing something really simple? I've tried disabling the lan connection, but all to no avail. Thanks. public class WinInetController {
5
2989
by: Paul W Smith | last post by:
My application uses two ways to connect to the Access db: Programtically: Dim sDBPath = "Data Source=D:\MCCL\AccessDB\NewMCCL.mdb;" Dim sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;" & sDBPath Dim myConnection As New OleDbConnection(sConnString) By Declaring:
5
4990
by: vieraci | last post by:
Hi, I'm wanting to start a database connection at the start of an app and keep it open for all methods and classes that I'm #including in my project. First I went about it by creating the connection in the Main source file outside of any class declarations and then declaring it external in other source files. // Main cpp file #include...
3
1775
by: puzzlecracker | last post by:
What I currently have and request a suggestion to modularize it public sealed class Connection: BaseConnection{ //I have to process about 30 events public event Handler1=handler1; public event Handler2=handler2; public event Handler3=handler3; public event Handler4=handler4;
0
7484
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7415
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5344
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4963
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3470
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3451
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1030
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
726
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.