本文整理汇总了C#中DAL.Connection.closeConnection方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.closeConnection方法的具体用法?C# Connection.closeConnection怎么用?C# Connection.closeConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DAL.Connection
的用法示例。
在下文中一共展示了Connection.closeConnection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public int Insert(Entities.TheGiamGia pb1)
{
try
{
pb = new Constants.TheGiamGia();
Sql = new Constants.Sql();
string sql = Sql.InsertTheGiamGia;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(pb.HanhDong, SqlDbType.NVarChar, 50).Value = pb1.HanhDong;
cmd.Parameters.Add(pb.MaTheGiamGia, SqlDbType.VarChar, 50).Value = pb1.MaTheGiamGia;
cmd.Parameters.Add(pb.MaKhachHang, SqlDbType.VarChar, 50).Value = pb1.MaKhachHang;
cmd.Parameters.Add(pb.GiaTriThe, SqlDbType.Float).Value = pb1.GiaTriThe;
cmd.Parameters.Add(pb.NgayBatDau, SqlDbType.DateTime).Value = pb1.NgayBatDau;
cmd.Parameters.Add(pb.NgayKetThuc, SqlDbType.DateTime).Value = pb1.NgayKetThuc;
cmd.Parameters.Add(pb.Deleted, SqlDbType.Bit).Value = pb1.Deleted;
int i = cmd.ExecuteNonQuery();
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return i;
}
catch (Exception ex)
{
string s = ex.Message;
return 0;
}
}
示例2: Delete
public void Delete(Entities.TKNganHang tk1)
{
try
{
TKNH = new Constants.TKNganHang();
Entities.TKNganHang TKNganHang = new Entities.TKNganHang();
Sql = new Constants.Sql();
string sql = Sql.DeleteTKNganHang;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(TKNH.HanhDong, SqlDbType.NVarChar, 20).Value = tk1.HanhDong;
cmd.Parameters.Add(TKNH.TKNganHangID, SqlDbType.Int).Value = tk1.TKNganHangID;
cmd.ExecuteNonQuery();
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
}
catch (Exception ex)
{
string s = ex.Message;
}
}
示例3: Delete
//delete
public bool Delete(Entities.NhomHang NhomHang)
{
bool kt = false;
try
{
nhh = new Constants.NhomHangHoa();
Entities.NhomHang nhomhanghoa = new Entities.NhomHang();
Sql = new Constants.Sql();
string sql = Sql.DeleteNhomHangHoa;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(nhh.HanhDong, SqlDbType.NVarChar, 20).Value = NhomHang.HanhDong;
cmd.Parameters.Add(nhh.NhomHangID, SqlDbType.Int).Value = NhomHang.NhomHangID;
int i = cmd.ExecuteNonQuery();
if (i == 1)
kt = true;
else
kt = false;
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return kt;
}
catch
{
return kt;
}
}
示例4: InsertUpdate
public int InsertUpdate(Entities.NhomTKKeToan pb1)
{
try
{
ntkkt = new Constants.NhomTKKeToan();
Sql = new Constants.Sql();
string sql = Sql.InsertUpdateNhomTKKeToan;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(ntkkt.HanhDong, SqlDbType.NVarChar, 20).Value = pb1.HanhDong;
cmd.Parameters.Add(ntkkt.NhomTKKeToanID, SqlDbType.Int).Value = pb1.NhomTKKeToanID;
cmd.Parameters.Add(ntkkt.MaNhomTKKeToan, SqlDbType.NVarChar, 20).Value = pb1.MaNhomTKKeToan;
cmd.Parameters.Add(ntkkt.TenNhomTKKeToan, SqlDbType.NVarChar, 200).Value = pb1.TenNhomTKKeToan;
cmd.Parameters.Add(ntkkt.GhiChu, SqlDbType.NVarChar, 100).Value = pb1.GhiChu;
cmd.Parameters.Add(ntkkt.Deleted, SqlDbType.Bit).Value = pb1.Delete;
int i = cmd.ExecuteNonQuery();
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return i;
}
catch (Exception ex)
{
string s = ex.Message;
return 0;
}
}
示例5: CapNhatDuNoKhachHang
/// <summary>
///
/// </summary>
/// <param name="giatri"></param>
/// <returns></returns>
public int CapNhatDuNoKhachHang(Entities.TruyenGiaTri giatri)
{
int tra = 0;
try
{
Sql = new Constants.Sql();
string sql = "exec sp_CapNhatDuNoKhachHang @MaKhachHang,@DuNo";
conn = new Connection();
cn = conn.openConnection();
cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add("MaKhachHang", SqlDbType.VarChar, 20).Value = giatri.Giatritruyen;
cmd.Parameters.Add("DuNo", SqlDbType.Float).Value = giatri.Giatrithuhai;
tra = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
string s = ex.Message.ToString();
tra = 0;
}
finally
{
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
}
return tra;
}
示例6: deleteNhomQuyen
public bool deleteNhomQuyen(Entities.NhomQuyen nq1)
{
try
{
bool kt = false;
nq = new Constants.NhomQuyen();
Sql = new Constants.Sql();
string sql = Sql.deleteNhomQuyen;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(nq.TenNhomQuyen, SqlDbType.VarChar, 50).Value = nq1.TenNhomQuyen;
int i = cmd.ExecuteNonQuery();
if (i >= 0)
kt = true;
else
kt = false;
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return kt;
}
catch (Exception ex)
{
string s = ex.Message;
return false;
}
}
示例7: sp_ThongTinCongTy
/// <summary>
/// lay bang cong ty
/// </summary>
/// <param name="ct"></param>
/// <returns></returns>
public Entities.ThongTinCongTy sp_ThongTinCongTy(Entities.TruyenGiaTri ct)
{
Entities.ThongTinCongTy banghi = new Entities.ThongTinCongTy();
try
{
string sql = "exec sp_ThongTinCongTy @MaCongTy";
conn = new Connection();
cn = conn.openConnection();
cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add("MaCongTy", SqlDbType.VarChar, 20).Value = ct.Giatritruyen;
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
ArrayList arr = new ArrayList();
while (dr.Read())
{
banghi.MaCongTy = dr[0].ToString();
banghi.TenCongTy = dr[1].ToString();
banghi.DiaChi = dr[2].ToString();
banghi.SoDienThoai = dr[3].ToString();
banghi.Email = dr[4].ToString();
banghi.Website = dr[5].ToString();
banghi.Fax = dr[6].ToString();
}
}
catch (Exception ex)
{ string s = ex.Message.ToString(); banghi = null; }
finally
{
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
}
return banghi;
}
示例8: Delete
public bool Delete(string maHDBanHang)
{
try
{
bool kt = false;
hdbh = new Constants.HDBanHang();
Sql = new Constants.Sql();
string sql = Sql.DeleteHDBanHang;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add("@maHDBanHang", SqlDbType.VarChar, 20).Value = maHDBanHang;
int i = cmd.ExecuteNonQuery();
if (i == 1)
kt = true;
else
kt = false;
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return kt;
}
catch (Exception ex)
{
string s = ex.Message;
return false;
}
}
示例9: Insert
/// <summary>
///
/// </summary>
/// <param name="gv"></param>
/// <returns></returns>
public bool Insert(Entities.GiaVonBanHang gv)
{
bool kt = false;
try
{
string sql = Common.GiaVonBanHang.Insert;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(Common.GiaVonBanHang.MaHoaDon, SqlDbType.VarChar, 50).Value = gv.MaHoaDon;
cmd.Parameters.Add(Common.GiaVonBanHang.MaHangHoa, SqlDbType.VarChar, 50).Value = gv.MaHangHoa;
cmd.Parameters.Add(Common.GiaVonBanHang.GiaVon, SqlDbType.Float).Value = gv.GiaVon;
int i = cmd.ExecuteNonQuery();
if (i == 1)
kt = true;
else
kt = false;
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return kt;
}
catch (Exception ex)
{
string s = ex.Message;
return false;
}
}
示例10: Delete
public int Delete(Entities.TheGiamGia pb1)
{
try
{
pb = new Constants.TheGiamGia();
Sql = new Constants.Sql();
string sql = Sql.DeleteTheGiamGia;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(pb.MaTheGiamGia, SqlDbType.VarChar, 50).Value = pb1.MaTheGiamGia;
int i = cmd.ExecuteNonQuery();
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return i;
}
catch (Exception ex)
{
string s = ex.Message;
return 0;
}
}
示例11: Delete
/// <summary>
/// Delete Bảng
/// </summary>
public int Delete(Entities.NhomKH nkh2)
{
int Trave = 0;
try
{
nkh = new Constants.NhomKH();
Sql = new Constants.Sql();
string sql = Sql.DeleteNhomKH;
conn = new Connection();
cn = conn.openConnection();
cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(nkh.HanhDong, SqlDbType.NVarChar, 20).Value = nkh2.Hanhdong.ToString();
cmd.Parameters.Add(nkh.NhomKHID, SqlDbType.Int).Value = nkh2.NhomKHID;
Trave = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{ string s = ex.Message.ToString(); }
finally
{
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
}
return Trave;
}
示例12: Delete
/// <summary>
/// Delete Bảng
/// </summary>
public bool Delete(Entities.SoDuCongNo pxh)
{
try
{
bool kt = false;
pt = new Constants.CongNo();
Sql = new Constants.Sql();
string sql = Sql.DeleteSoDuCongNo;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(pt.MaSoDuCongNo, SqlDbType.VarChar, 20).Value = pxh.MaSoDuCongNo;
int i = cmd.ExecuteNonQuery();
if (i == 1)
kt = true;
else
kt = false;
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return kt;
}
catch
{
return false;
}
}
示例13: InsertTyLeTinh
//==============Insert========================
public int InsertTyLeTinh(Entities.TyLeTinh input)
{
int bg = 0;
try
{
con = new Connection();
cn = con.openConnection();
cmd = new SqlCommand("exec sp_TyLeTinh @ThaoTac,@MaTyLeTinh,@SoTien,@NgayNhap,@GhiChu,@Deleted", cn);
cmd.Parameters.Add("ThaoTac", SqlDbType.NVarChar).Value = "insert";
//set
cmd.Parameters.Add("MaTyLeTinh", SqlDbType.VarChar).Value = input.MaTyLeTinh;
cmd.Parameters.Add("SoTien", SqlDbType.Float).Value = input.SoTien;
cmd.Parameters.Add("NgayNhap", SqlDbType.DateTime).Value = input.NgayNhap;
cmd.Parameters.Add("GhiChu", SqlDbType.NVarChar).Value = input.GhiChu;
cmd.Parameters.Add("Deleted", SqlDbType.Bit).Value = input.Deleted;
bg = cmd.ExecuteNonQuery();
}
catch (Exception)
{
bg = 0;
}
finally
{
cmd.Connection.Dispose();
cn.Close();
con.closeConnection();
}
if (bg == 0)
return bg;
return bg;
}
示例14: Delete
/// <summary>
/// Delete Bảng
/// </summary>
public bool Delete(Entities.PhieuTTCuaKH pttckh)
{
try
{
bool kt = false;
pt = new Constants.PhieuTTCuaKH();
Sql = new Constants.Sql();
string sql = Sql.DeletePhieuTTCuaKH;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(pt.HanhDong, SqlDbType.NVarChar, 20).Value = pttckh.HanhDong;
cmd.Parameters.Add(pt.PhieuTTCuaKHID, SqlDbType.Int).Value = pttckh.PhieuTTCuaKHID;
int i = cmd.ExecuteNonQuery();
if (i == 1)
kt = true;
else
kt = false;
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
return kt;
}
catch
{
return false;
}
}
示例15: Delete
//delete
public int Delete(Entities.KhoHang kh1)
{
int tra = 0;
try
{
kh = new Constants.KhoHang();
Entities.KhoHang khohang = new Entities.KhoHang();
Sql = new Constants.Sql();
string sql = Sql.DeleteKhoHang;
Connection conn = new Connection();
SqlConnection cn = conn.openConnection();
SqlCommand cmd = new SqlCommand(sql, cn);
cmd.Parameters.Add(kh.HanhDong, SqlDbType.NVarChar, 20).Value = kh1.HanhDong;
cmd.Parameters.Add(kh.KhoHangID, SqlDbType.Int).Value = kh1.KhoHangID;
tra = cmd.ExecuteNonQuery();
cmd.Connection.Dispose();
cn.Close();
conn.closeConnection();
cn = null;
conn = null;
}
catch (Exception ex)
{ string s = ex.Message; tra = 0; }
return tra;
}