SqlConnection.DataSource : SqlConnection « System.Data.SqlClient « C# / C Sharp by API






SqlConnection.DataSource

 

using System;
using System.Data;
using System.Data.SqlClient;

class MySqlConnection {
  public static void Main() {
    string connectionString = "server=(local)\\SQLEXPRESS;database=MyDatabase;Integrated Security=SSPI";

    SqlConnection mySqlConnection = new SqlConnection(connectionString);

    mySqlConnection.Open();

    Console.WriteLine("mySqlConnection.ConnectionString = "+mySqlConnection.ConnectionString);
    Console.WriteLine("mySqlConnection.ConnectionTimeout = "+mySqlConnection.ConnectionTimeout);
    Console.WriteLine("mySqlConnection.Database = "+mySqlConnection.Database);
    Console.WriteLine("mySqlConnection.DataSource = "+mySqlConnection.DataSource);
    Console.WriteLine("mySqlConnection.PacketSize = "+mySqlConnection.PacketSize);
    Console.WriteLine("mySqlConnection.ServerVersion = "+mySqlConnection.ServerVersion);
    Console.WriteLine("mySqlConnection.State = "+mySqlConnection.State);
    Console.WriteLine("mySqlConnection.WorkstationId = "+mySqlConnection.WorkstationId);

    mySqlConnection.Close();
  }
}

   
  








Related examples in the same category

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