Ejemplo n.º 1
0
        public DataTable GetData()
        {
            DataTable dt = new DataTable();

            cmd.CommandText = "SELECT * From tb_KhacHang";
            cmd.CommandType = CommandType.Text;
            cmd.Connection  = con.Connection;
            try
            {
                con.OpenConn();
                SqlDataAdapter sda = new SqlDataAdapter();
                sda.Fill(dt);
                con.CloseConn();
            }
            catch (Exception ex)
            {
                string mex = ex.Message;
                cmd.Dispose();
                con.CloseConn();
            }
            return(dt);
        }