Information Technology Consulting Service

www.katarincic.com


Welcome Guest Search | Active Topics | Members | Log In

Adding a connection string to an app Options · View
scott
Posted: Thursday, April 03, 2008 1:06:59 PM
Rank: Administration
Groups: Member

Joined: 3/24/2008
Posts: 2,871
Points: 5,789
Location: South Florida USA
Adding a connection string to an app

In the web.config:
(this assumes SQL Server authentication)

Code:

    <connectionStrings>
        <add name="connectionname" connectionString="server=servername;database=databasename;user id=username;password=userpassword" providerName="System.Data.SqlClient"/>
    </connectionStrings>


in the VB code:

Code:

    Public Shared Function ConnectionString() As String

        Dim cs As String = ConfigurationManager.ConnectionStrings("connectionname").ConnectionString

        Return cs

    End Function
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFPro Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.6 (NET v2.0) - 11/14/2007
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.027 seconds.