Professional Documents
Culture Documents
-Đây là website bán hàng thông minh trực tuyến nhằm hỗ trợ khách
hàng có thể tự đặt hàng online, tiết kiệm thời gian.
-Dự án bao gồm 2 phần: Client (phía khách hàng) và Admin (Phía
quản trị viên.
-Các module:
• Phía Client:Trang chủ, Danh mục macbook, Danh mục điện thoại, Danh mục Pc, Trang blog,
Trang liên hệ.
• Phía Admin:LoginAdmin, Thêm sản phẩm, CRD sản phẩm.
+Phía Client:
• Đăng nhập
-Trang chủ
-Danh mục macbook
-Danh mục điện thoại
-Danh mục Pc
-Trang blog
-Trang liên hệ
-Trang LoginAdmin
-Trang Admin
4.CHỤP CODE
-CODE MASTER
+Master
<!DOCTYPE html>
<html>
<head runat="server">
<meta charset="UTF-8">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap"
rel="stylesheet">
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"></script> -->
<script src="jquery.min.js"></script>
<script src="owlcarousel/owl.carousel.min.js"></script>
<title>Project-C#-Sql-.net </title>
</asp:ContentPlaceHolder>
<style>
.horizontal-list li {
margin-right: 10px;
table tbody {
display: flex;
table tbody tr {
margin-right: 39px;
.login-container {
display: flex;
justify-content: center;
align-items: center;
margin-top: 50px;
</style>
</head>
<body>
<div>
<div id="wrapper">
<div id="header">
<div class="container">
<div class="row">
<div class="time">
</div>
<div class="number-phone">
</div>
</div>
</div>
</div>
</div>
<nav>
</a>
<div class="horizontal-list">
<ItemTemplate>
</asp:LinkButton>
</ItemTemplate>
</asp:DataList>
</div>
<div>
<a href="blog.aspx">Blog</a>
</div>
</div>
</div>
</div>
</nav>
</div>
</div>
</asp:ContentPlaceHolder>
<div class="login-container">
</div>
<div id="footer">
<div class="container">
<div class="row">
<div class="box-head">
<h3>ĐỊA CHỈ</h3>
</div>
<div class="box-body">
</ul>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="box">
<div class="box-head">
</div>
<div class="box-body">
<li>
</li>
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="box">
<div class="box-head">
<h3>DANH MỤC</h3>
</div>
<div class="box-body">
<li>
</li>
<li>
<a href="">Váy</a>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="box">
<div class="box-head">
<h3>SOCIAL</h3>
</div>
<div class="box-body">
<li>
</li>
<li>
</li>
<li>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="wp-copyright" class="d-none d-md-block">
<div class="container">
<div class="row">
<div class="col-md-12">
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
+CODE Master.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace TranMinhNghia_8504
{
public partial class MasterPage : System.Web.UI.MasterPage
{
lopketnoi ketnoi = new lopketnoi();
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//string maloai = Content.Items["maloai"] + "";
string sql = "select * from DANHMUC";
dl_danhmuc.DataSource = ketnoi.docdulieu(sql);
dl_danhmuc.DataBind();
}
+Aspx
</style>
<div id="content">
<div id="slider-banner">
<div class="container-fluid px-0">
<div class="row">
<div class="col-12 px-0">
<div id="home-slide" class="carousel slide" data-
ride="carousel">
<div class="carousel-inner">
<div class="carousel-item">
<a href="">
<img src="image/header.jpg" alt=""
class="d-block w-100">
</a>
</div>
<div class="carousel-item">
<a href="">
<img src="image/header.jpg" alt=""
class="d-block w-100">
</a>
</div>
</ItemTemplate>
</asp:DataList>
</asp:Content>
+Code Defaul.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TranMinhNghia_8504
{
public partial class Default : System.Web.UI.Page
{
lopketnoi ketnoi = new lopketnoi();
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
string madanhmuc = Context.Items["MADANHMUC"] + "";
string sql;
if (madanhmuc != "")
{
sql = "select * from THIETBI where MADANHMUC = " + madanhmuc + " ";
}
else
sql = "select * from THIETBI";
dl_mathang.DataSource = ketnoi.docdulieu(sql);
dl_mathang.DataBind();
}
text-align: center;
}
</style>
<h2 style="display: flex; justify-content: center; align-items: center;">Trang bài
viết
</h2>
<div class="section-detail">
<h3 class="section-title"><b>Iphone 14 Pro Max có thể khan hiếm hàng dịp
cuối năm</b></h3>
<span class="create-date">2022-12-30 10:58:07</span>
<div class="detail">
<p>Dẫn nguồn tin từ chuỗi cung ứng, trang Bloomberg Apple đang phải đối
mặt với tình trạng thiếu hụt gần 6 triệu chiếc iPhone 14 Pro và iPhone 14 Pro Max trong
năm nay.</p>
<p>Tình trạng bất ổn tại nhà máy sản xuất iPhone lớn nhất thế giới của
Foxconn ở Trịnh Châu đã kéo dài trong hơn một tháng qua. Hàng nghìn nhân viên bỏ việc,
khiến đối tác của Apple thiếu nhân công để lắp ráp iPhone.</p>
<figure class="image align-center">
<img title="iPhone 14 Pro Max có thể khan hàng dịp cuối năm - 1"
src="https://icdn.dantri.com.vn/thumb_w/680/2022/11/28/iphone-14-pro-max-
1669612345064.jpg" alt="iPhone 14 Pro Max có thể khan hàng dịp cuối năm - 1" data-
width="1440" data-height="810" data-
original="https://icdn.dantri.com.vn/2022/11/28/iphone-14-pro-max-1669612345064.jpg"
data-photo-id="2238764" data-track-content="" data-content-name="article-content-image"
data-content-piece="article-content-image_2238764" data-content-
target="/suc-manh-so/iphone-14-pro-max-co-the-khan-hang-dip-cuoi-nam-
20221201175945316.htm" data-adbro-processed="true">
<figcaption>
<p>Nguồn cung đối với iPhone 14 Pro và iPhone 14 Pro Max vẫn chưa
ổn định (Ảnh: SCMP).</p>
</figcaption>
</figure>
<p>Hiện tại, đây là nhà máy chịu trách nhiệm chính trong hoạt động sản
xuất <a href="https://dantri.com.vn/tim-kiem/iphone+14.htm" data-auto-link-
id="62cea286d111cdb85e86a5ad" data-track-content="" data-content-name="article-content-
autolink" data-content-piece="article-content-autolink_62cea286d111cdb85e86a5ad" data-
content-target="/suc-manh-so/iphone-14-pro-max-co-the-khan-hang-dip-cuoi-nam-
20221201175945316.htm">iPhone 14</a> Pro và iPhone 14 Pro Max. Sau thông tin trên,
cổ phiếu Apple đã giảm 2,6% giá trị. Nguồn tin này cho biết Apple và Foxconn kỳ vọng có
thể bù đắp sự thiếu hụt trên vào năm 2023.</p>
<p>Theo các chuyên gia từ <em>Counterpoint Research</em>, thời gian
giao hàng đối với <a href="https://dantri.com.vn/tim-kiem/iphone+14+pro.htm" data-
auto-link-id="62cea2aad111cdb85e86da91" data-track-content="" data-content-name="article-
content-autolink" data-content-piece="article-content-autolink_62cea2aad111cdb85e86da91"
data-content-target="/suc-manh-so/iphone-14-pro-max-co-the-khan-hang-dip-cuoi-nam-
20221201175945316.htm">iPhone 14 Pro</a> và iPhone 14 Pro Max đã tăng lên mức kỷ
lục. Cụ thể, người dùng đặt mua hai mẫu máy này sẽ phải chờ đợi đến 37 ngày để có thể
nhận được máy. Trong khi đó, hai mẫu <a contenteditable="false"
href="https://dantri.com.vn/suc-manh-so/iphone-14-giam-gia-rat-sau-thi-truong-don-nhan-
tich-cuc-20221128003943786.htm">iPhone 14</a> tiêu chuẩn vẫn sẵn hàng.</p>
<p>"Chúng tôi ước tính Apple đang thiếu hụt iPhone nghiêm trọng. Điều đó
sẽ khiến công ty bị giảm ít nhất 5% doanh số trong quý và có khả năng lên đến 10% tùy
thuộc vào hoạt động sản xuất của nhà máy Foxconn trong vài tuần tới", Dan Ives - nhà phân
tích của <em>Wedbush</em>, nhận định.</p>
<p>Trong một bài đăng trên Twitter, nhà phân tích Ming-Chi Kuo dự kiến
Apple sẽ xuất xưởng ít hơn 15-20 triệu chiếc iPhone 14 Pro và <a
href="https://dantri.com.vn/tim-kiem/iphone+14+pro+max.htm" data-auto-link-
id="62cea2d5d111cdb85e86fd3f" data-track-content="" data-content-name="article-content-
autolink" data-content-piece="article-content-autolink_62cea2d5d111cdb85e86fd3f" data-
content-target="/suc-manh-so/iphone-14-pro-max-co-the-khan-hang-dip-cuoi-nam-
20221201175945316.htm">iPhone 14 Pro Max</a> so với dự kiến. Theo Kuo, công
suất của nhà máy tại Trịnh Châu chỉ đạt 20% trong tháng 11. Dự kiến, con số này sẽ tăng
lên khoảng 30-40% trong tháng tới.</p>
<p>Tuy nhiên, Kuo nói rằng nhu cầu của người dùng đối với dòng sản phẩm
iPhone 14 Pro đang dần biết mất. Nguyên nhân là do thời gian chờ đợi quá lâu.</p>
<p>"Những người tiêu dùng không thể mua được chiếc iPhone 14 Pro vào lúc
này sẽ không trì hoãn việc mua hàng của họ. Trong tình hình suy thoái kinh tế như hiện
nay, nhiều khả năng người dùng sẽ quên đi việc mua hàng, thay vì chờ đợi và tiếp tục mua
máy trong tương lai", Kuo viết.</p>
<p>Cũng theo nhận định từ nhiều chuyên gia, Apple đang tìm cách đa dạng
hóa nguồn cung ứng, nhằm giảm sự phụ thuộc vào Trung Quốc. Hiện tại, công ty đang tích
cực mở rộng nhiều hoạt động thông qua các đối tác ở Ấn Độ, Mexico và Việt Nam.</p>
<p>Tại thị trường Việt Nam, tình trạng khan hàng đối với iPhone 14 Pro và
iPhone 14 Pro Max cũng liên tục kéo dài kể từ khi bộ đôi này lên kệ. Giữa tháng 11, một
lô hàng lớn đã được nhập về, nhưng vẫn chưa đáp ứng được hết nhu cầu của khách hàng.</p>
<p>"Đợt hàng vừa qua đã tạm thời giúp "giải nhiệt" nhu cầu của thị
trường. Hiện tại, lượng hàng iPhone 14 Pro và iPhone 14 Pro Max có thể đáp ứng được 50%
nhu cầu của người dùng", bà Phùng Phương - đại diện truyền thông hệ thống Di Động Việt,
chia sẻ.</p>
<p>Bà Phương cho biết thêm rằng đợt hàng tiếp theo sẽ được đưa về vào
giữa tháng 12. Tuy nhiên, vẫn chưa thể xác định chính xác nguồn cung từ Apple có đủ để
đáp ứng nhu cầu mua sắm của người dùng vào dịp cuối năm hay không. Nhiều khả năng, các
phiên bản như iPhone 14 Pro Max màu tím vẫn sẽ đối mặt với tình trạng khan hàng, ngay cả
khi có đợt nhập máy mới.</p>
</div>
</div>
</div>
</asp:Content>
<div class="detail">
<p style="text-align: center;"><strong>THÔNG TIN LIÊN HỆ</strong><br>
Tư vấn & Hỗ Trợ trực tuyến :<br>
Hoạt Động Từ (08:30 - 12:00; 13:30 - 23:30)</p>
<p style="text-align: center;">Số điện thoại liên hệ : 0123456789</p>
<p style="text-align: center;">Facebook : nhóm 1</p>
<p style="text-align: center;"> </p>
<p style="text-align: center;">Đà Nẵng : (034).5910508</p>
<p style="text-align: center;">TP.ĐÀ NẴNG : (034).5910508</p>
<p style="text-align: center;">Email hỗ trợ bán hàng Online, doanh nghiệp
: nhom1<a href="mailto:dn5678853@gmail.com">@gmail.com</a></p>
<p style="text-align: center;">Mọi thông tin chi tiết về dịch vụ làm chăm
sóc khách hàng, hãy liên hệ những thông tin bên trên Xin cảm ơn !</p>
<p>
<img style="display: block; margin-left: auto; margin-right: auto;"
src="https://cdn.pixabay.com/photo/2017/10/17/10/03/contact-2860030__340.jpg"
srcset="https://cdn.pixabay.com/photo/2017/10/17/10/03/contact-2860030__340.jpg 1x,
https://cdn.pixabay.com/photo/2017/10/17/10/03/contact-2860030__480.jpg 2x" alt="Liên
Lạc, Thăm Nom, Chữ Cái, E-Mail"></p>
</div>
</div>
</div>
</asp:Content>
table.custom-table tbody {
display: block;
}
.custom-container {
display: flex;
justify-content: center;
align-items: center;
}
</style>
<div class="custom-container">
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<table style="width: 100%; height: 300px;margin-top:30px;" class="custom-
table">
<tr>
<td rowspan="4">
<asp:Image ID="Image1" runat="server" Height="166px"
ImageUrl='<%# "image/"+Eval("HINHANH") %>' Width="143px" />
</td>
<td>
<asp:Label ID="Label1" runat="server" Text='<%#
Eval("TENTHIETBI") %>'></asp:Label>
</td>
</tr>
<tr>
<td>Mô Tả:
<asp:Label ID="Label2" runat="server" Text='<%# Eval("MOTA")
%>'></asp:Label>
</td>
</tr>
<tr>
<td>Đơn Giá:<asp:Label ID="Label3" runat="server" Text='<%#
Eval("DONGIA") %>'></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style3">Số Lượng:
<asp:TextBox ID="txtSoluong" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Đặt Hàng"
CommandArgument='<%# Eval("MATHIETBI") %>' OnClick="Button1_Click" />
<a href="giohang.aspx">Giỏ hàng</a>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
<asp:Label ID="lb_thongBao" runat="server" Text=""></asp:Label>
</asp:Content>
+CODE CHITIETSANPHAM.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
namespace TranMinhNghia_8504
{
public partial class chititetsanpham : System.Web.UI.Page
{
lopketnoi ketnoi = new lopketnoi();
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
string mathietbi = Context.Items["MATHIETBI"] + "";
if (mathietbi != "")
{
string sql = "Select * from THIETBI where mathietbi = '" + mathietbi +
"'";
DataList1.DataSource = ketnoi.docdulieu(sql);
DataList1.DataBind();
}
else
{
lb_thongBao.Text = "Sản Phẩm không tồn tại";
}
}
int kq = ketnoi.capnhat(sql);
if (kq > 0) lb_thongBao.Text = "thành công";
}
else
{
lb_thongBao.Text = "bạn phải đăng nhập";
}
}
-CODE GIOHANG.ASPX
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.Master"
AutoEventWireup="true" CodeBehind="giohang.aspx.cs" Inherits="TranMinhNghia_8504.giohang"
%>
<Columns>
<ItemTemplate>
<asp:TextBox ID="txtSoluong" runat="server" Text='<%# Eval("SOLUONG")
%>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="THANHTIEN" HeaderText="Thành tiền" />
<asp:TemplateField HeaderText="xóa">
<ItemTemplate>
<asp:LinkButton ID="LinkButton3" runat="server" CommandArgument='<%#
Eval("MATHIETBI") %>' OnClick="LinkButton3_Click">xóa</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
-CODE GIOHANG.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TranMinhNghia_8504
{
public partial class giohang : System.Web.UI.Page
{
lopketnoi ketnoi = new lopketnoi();
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
string tendangnhap = Session["username"] + "";
if (tendangnhap == "") return;
load_dulieu(tendangnhap);
}
protected void load_dulieu(string tendangnhap)
{
string sql = "select THIETBI.MATHIETBI, TENTHIETBI,MOTA,DONGIA,SOLUONG,
DONGIA*SOLUONG AS THANHTIEN" +
" from THIETBI,DATHANG " +
"where THIETBI.MATHIETBI = DATHANG.MATHIETBI and TENKHACHHANG='" +
tendangnhap + "'";
GridView1.DataSource = ketnoi.docdulieu(sql);
GridView1.DataBind();
}
public void LinkButton3_Click(object sender, EventArgs e)
{
string tendangnhap = Session["username"] + "";
if (tendangnhap == "") return;
string mathietbi = ((LinkButton)sender).CommandArgument;
string sql = "delete from DATHANG where TENKHACHHANG='" + tendangnhap + "'
and MATHIETBI=" + mathietbi;
int kq = ketnoi.capnhat(sql);
if (kq > 0)
{
lbthongbao.Text = "thành công";
}
else lbthongbao.Text = "không thành công";
load_dulieu(tendangnhap);
}
string sql = "update DATHANG set SOLUONG = " + soluong + " where
TENKHACHHANG='" + tendangnhap + "' and MATHIETBI=" + mathietbi;
int kq = ketnoi.capnhat(sql);
if (kq > 0)
{
lbthongbao.Text = "Thành công";
}
else lbthongbao.Text = "không thành công";
load_dulieu(tendangnhap);
}
}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.center-div {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
/* Thiết lập chiều cao bằng chiều cao của màn hình */
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="center-div">
<h2>ĐĂNG NHẬP</h2>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace TranMinhNghia_8504
{
public partial class loginAdmin : System.Web.UI.Page
{
protected string ErrorMessage { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ErrorMessage = "";
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
string username = txtUsername.Text.Trim();
string password = txtPassword.Text.Trim();
// Kiểm tra tên người dùng và mật khẩu (ở đây chỉ là một ví dụ đơn giản)
if (username == "admin" && password == "12345")
{
// Đăng nhập thành công, chuyển hướng vào trang admin
Response.Redirect("Admin.aspx");
}
else
{
// Hiển thị thông báo lỗi đăng nhập
lb_thongbao.Text = "Tên người dùng hoặc mật khẩu không chính xác.";
}
}
}
}
-CODE ADMIN.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin.aspx.cs"
Inherits="TranMinhNghia_8504.Admin" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<h2>Thêm sản phẩm</h2>
<div>
<table style="width: 100%;">
<tr>
<td>
<label for="txtProductName">Tên sản phẩm:</label></td>
<td>
<label for="txtDescription">Mô tả:</label></td>
<td>
<label for="txtPrice">Giá sản phẩm:</label></td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtProductName"
runat="server"></asp:TextBox></td>
<td>
<asp:TextBox ID="txtDescription"
runat="server"></asp:TextBox></td>
<td>
<asp:TextBox ID="txtPrice" runat="server"></asp:TextBox></td>
</tr>
</table>
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%#
"image/"+Eval("HINHANH") %>' Width="200px" CommandArgument='<%# Eval("MATHIETBI") %>'
OnClick="ImageButton1_Click" />
<br />
<asp:LinkButton ID="LinkButton1" runat="server" Text='<%#
Eval("TENTHIETBI") %>' CommandArgument='<%# Eval("MATHIETBI") %>'
OnClick="LinkButton1_Click"></asp:LinkButton>
<br />
Đơn Giá:<asp:Label ID="Label3" runat="server" Text='<%# Eval("DONGIA")
%>'></asp:Label>
<%-- <asp:LinkButton ID="LinkButton2" runat="server">CHI
TIẾT</asp:LinkButton>--%>
<br />
<asp:LinkButton ID="lnkDelete" runat="server" Text="Xóa"
CommandName="Delete" CommandArgument='<%# Eval("MATHIETBI") %>' OnClientClick="return
confirm('Bạn có chắc chắn muốn xóa sản phẩm?');"></asp:LinkButton>
</ItemTemplate>
</asp:DataList>
<asp:Label ID="lbthongbao" runat="server" Text=""></asp:Label>
</form>
</body>
</html>
-CODE ADMIN.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;
namespace TranMinhNghia_8504
{
public partial class Admin : System.Web.UI.Page
{
lopketnoi ketnoi = new lopketnoi();
// Hiển thị thông báo hoặc thực hiện các hành động khác sau khi lưu dữ
liệu thành công
lblMessage.Text = "Sản phẩm đã được thêm thành công!";
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
string mahang = ((LinkButton)sender).CommandArgument;
Context.Items["MATHIETBI"] = mahang;
Server.Transfer("chititetsanpham.aspx");
}
// Sau khi xóa, cập nhật lại danh sách sản phẩm.
BindDataList();
}
}
-CODE LOPKETNOI.CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
namespace TranMinhNghia_8504
{
public class lopketnoi : System.Web.UI.Page
{
SqlConnection conn;
private void layketnoi()
{
string sqlCon = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=" +
Server.MapPath("/App_Data/dbTHIETBI.mdf") + ";Integrated Security=True";
conn = new SqlConnection(sqlCon);
conn.Open();
}
private void dongketnoi()
{
if (conn.State == ConnectionState.Open)
{
conn.Close();
}
}
public DataTable docdulieu(string sql)
{
DataTable dt = new DataTable();
try
{
layketnoi();
SqlDataAdapter da = new SqlDataAdapter(sql, conn);
da.Fill(dt);
}
catch
{
dt = null;
//thông báo lỗi
}
finally
{
dongketnoi();
}
return dt;
}
public int capnhat(string sql)
{
int kq = 0;
try
{
layketnoi();
SqlCommand cmd = new SqlCommand(sql, conn);
kq = cmd.ExecuteNonQuery();
}
catch
{
//lỗi
}
finally
{
dongketnoi();
}
return kq;
}
}
}