new SqlConnection(String connection) : SqlConnection « System.Data.SqlClient « C# / C Sharp by API






new SqlConnection(String connection)

  

using System;
using System.Data.SqlClient;

class MainClass 
{
  static void Main(string[] args)
  {
    SqlConnection MyConnection = new SqlConnection("Data Source=(local); Initial  Catalog = MyDatabase; User ID=sa;Password=");

    MyConnection.Open();
  }
}

   
    
  








Related examples in the same category

1.SqlConnection.BeginTransaction()
2.SqlConnection.ChangeDatabase
3.SqlConnection.ConnectionString
4.SqlConnection.ConnectionTimeout
5.SqlConnection.DataSource
6.SqlConnection.Database
7.SqlConnection.InfoMessage
8.SqlConnection.PacketSize
9.SqlConnection.ServerVersion
10.SqlConnection.State
11.SqlConnection.StateChange
12.SqlConnection.WorkstationId