Wednesday, June 10, 2009

ConnectionString with VB.NET

Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Web





Dim myConString As String = ConfigurationManager.ConnectionStrings("MyDatabaseConnectionStringIdentifier").ConnectionString

Dim Path As String = "C:\DBInfo.xml"
Dim doc As System.Xml.XmlDocument
Dim nodeList As System.Xml.XmlNodeList

Dim strConn As String
Dim objSqlConn As SqlConnection

doc = New XmlDocument()
doc.Load(Path)
node = doc.SelectSingleNode("Database/DB")
strConn = node.FirstChild.FirstChild.Value

No comments: