string SqlConnection = "data source = xyz; database = darabaseName; user id = xyz; password = xyz";SqlConnection con = null;con = new SqlConnection(SqlConnection);con.Open();string query = "Write a Query According to Ur Requirement";SqlCommand cmd = new SqlCommand(query, con);