Saturday, March 20, 2010

Connection Class

using System.Data.SqlClient;

public class DBConnection
{
protected static SqlConnection con = new SqlConnection();
public DBConnection()
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
con = new SqlConnection(@"Data Source=STUDENTSERVER;Initial Catalog=DBEuroIndia;User ID=sa;password='cool';");
con.Open();
}
}

No comments: