create a SqlConnection
Home :: 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
|