p; return ds.Tables[0];
}
finally
{
if ( connection.State == ConnectionState.Open )
connection.Close();
}
}
public static void ExecuteNonQuery(string query)
{
string connectionString = System.Configuration.ConfigurationSettings.AppSettings["connectionString"];
SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
try
{
SqlCommand cmd = new SqlCommand();
cmd = connection.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = query;
cmd.ExecuteNonQuery();
}
finally
{
if ( connection.State == ConnectionState.Open )
connection.Close();
}
}
public static object ExecuteScalar(string query)