Skip Navigation LinksHome > Browse by Catagory > Database > SqlConnection


SqlConnectionI

Calling connection string from your web.config
Connection string can be long.. and I can easily be too lazy to type them over n over again.

here is what you can do..
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration

Calling Connection String from web.confing
Dim cnnMe as SqlConnection
Dim cmdMe as sqlCommand

cnnMe = New SqlConnection()
cnnMe.ConnectionString = ConfigurationManager.ConnectionString("ConnectioName").ConnectionString

...

web.config
<connectionStrings>
    <add name="connectionStringName" connectionString="Data Source=YourDataSource;Initial Catalog=InitialData;Persist Security Info=True;User ID=userID;Password=Password"/>
</connectionStrings>
Tag: web.config SQL Connection
By: syantien | 12/31/2007 2:19:52 AM / 12/31/2007 2:24:15 AM

Comment

Re:SqlConnectionI

From: Guest:Take
Nice and simple, thanks.
Updated: 10/31/2008 8:12:45 PM



Comment

Name
 

Title

Email

Comment
 

Your IP Address is: 38.107.191.84

* to keep comments safe and clean, we display and keep your ip address.