Bước 4: Mã C# của thư viện DBClass
public class DBClass
{ public static int TruyVan_XuLy(String sql) {
String connectionString =
WebConfigurationManager.ConnectionStrings["eStore"].ConnectionString;
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand(sql, connection);
command.Connection.Open(); int soDong = command.ExecuteNonQuery(); command.Connection.Close();
return soDong;
}
public static DataTable TruyVan_TraVeTable(String sql) {
String connectionString =
WebConfigurationManager.ConnectionStrings["eStore"].ConnectionString;
SqlConnection connection = new SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);
DataTable table = new DataTable();
adapter.Fill(table);
return table;
}
}
» Tin mới nhất:
» Các tin khác: