create a SqlConnection
Skip Navigation Links.

create a SqlConnection

Skip Navigation LinksHome :: ASP.NET :: Data Access :: create SqlConnection

You create a SqlConnection object by passing in a connection string that provides the parameters needed to create a connection to a data source. The following Visual Basic .NET sample code creates a SqlConnection object to the Northwind SQL Server Database.

Dim strConn As String = _

"data source=localhost; " & _

"initial catalog=northwind; " & _

"integrated security=true"

Dim conn As New SqlConnection(strConn)

The following code accomplishes the same task in C#.

string strConn =

"data source=localhost; " +

"initial catalog=northwind; " +

"integrated security=true";

SqlConnection conn = new SqlConnection(strConn);

Next >> mixed mode authentication
top of page
all content ©1996/2012 BennySutton.com
all images © their respective owners This site uses Thumbshots previews