SQL Connection String in asp.net 1.1
Thursday 05 October 2006
If you are working in asp.net 2.0 or above, please visit the article titled '
SQL Connection String in asp.net 2.0 and above'.
Creating an SQL connection string in asp.net vb
First you need to create (if one doesn't already exist) called 'web.config'. This file should look something like below:-
<configuration>
<appSettings>
<add key="ConnectionString" value="server=server_name_or_ipaddress;Initial Catalog=database_name;User Id=username;Password=password;" />
</appSettings>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Then in your asp.net vb file use the below:-
Then the below is where you link to the connection string in the 'web.config' file:-
Dim MyConnection As SQLConnection
MyConnection = New SQLConnection(ConfigurationSettings.AppSettings("ConnectionString"))
|
(0)
|
|
|