using System.
Data;
using [Link];
using [Link];
namespace Shop_Manager;
internal class DataConn
{
private static string source;
private static SqlConnection con;
private static SqlCommand cmd;
private static SqlDataAdapter da;
private static DataSet ds;
static DataConn()
{
source = "Data Source=DESKTOP-RUVC0OI;Initial Catalog=qlbh;Integrated
Security=True";
con = new SqlConnection(source);
try
{
[Link]();
}
catch (SqlException)
{
[Link]("Lỗi cơ sở dữ liệu! Hãy xem trợ giúp!");
}
}
public static void DongKetNoi()
{
[Link]();
try
{
[Link]();
}
catch (SqlException)
{
[Link]("Lỗi cơ sở dữ liệu! Hãy xem trợ giúp!");
}
finally
{
[Link]();
}
}
public static void ThucHienCmd(string select)
{
cmd = new SqlCommand(select, con);
try
{
[Link]();
}
catch (SqlException se)
{
[Link]("Lỗi cơ sở dữ liệu! Hãy nhấn F1!");
[Link]([Link] ?? "");
}
}
public static DataSet GrdSource(string select)
{
da = new SqlDataAdapter(select, con);
ds = new DataSet();
[Link](ds);
return ds;
}
public static SqlDataReader ThucHienReader(string select)
{
cmd = new SqlCommand(select, con);
try
{
return [Link]();
}
catch (SqlException)
{
return null;
}
}
}