SQL Connection String in asp.net 1.1




SQL Connection String in asp.net 1.1 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"))


No one has said that they like article yet, be the first and click here (0)
Send a link to this page via email Send a link to this page