using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
class MainClass {
public static void Main() {
using (SqlConnection con = new SqlConnection()) {
con.ConnectionString = @"Data Source=.\sqlexpress;Database=Northwind;Integrated Security=SSPI";
con.Open();
if (con.State == ConnectionState.Open) {
Console.WriteLine(" Timeout = " + con.ConnectionTimeout);
} else {
Console.WriteLine("SqlConnection failed to open.");
Console.WriteLine(" Connection State = " + con.State);
}
}
}
}
|