Xin chào tất cả mọi người!
Mình mới vào làng nghề nhờ tất cả giúp đỡ nhé!
Mình đang viết phần mềm về quản lý quán cà phê nhưng đang bị lỗi liên kết từ Form Admin đến thẻ Tài Khoản qua DataGridView ai biết giúp mình với nhé, mình xin cảm ơn nhiều. Đây là 4 Form và 2 hình ảnh mình đã load nên.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CAFE
{
public partial class fAccountProfile : Form
{
public fAccountProfile()
{
InitializeComponent();
}
private void btnExti_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace CAFE
{
public partial class fAdmin : Form
{
public fAdmin()
{
InitializeComponent();
LoadAcountList();
}
void LoadAcountList()
{
string connectionSTR = @"Data Source=.\SQLEXPRESS;Initial Catalog=QLCAFE;Integrated Security=Truee";
sqlConnection connection = new sqlConnection(connectionSTR);
string query = "select * from dbo.ACCOUNT";
connection.Open();
sqlCommand command = new sqlCommand(query, connection);
DataTable data = new DataTable();
sqlDataAdapter adapter = new sqlDataAdapter(command);
adapter.fill(data);
connection.Close();
dtgvAcount.DataSource = data;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace CAFE
{
public partial class fLogin : Form
{
public fLogin()
{
InitializeComponent();
}
private void btnLogin_Click(object sender, EventArgs e)
{
fTableManager f = new fTableManager();
this.Hide();
f.ShowDialog();
this.Show();
}
private void btnExit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void fLogin_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("Bạn có muốn thoát chương trình?","Thông Báo",MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK)
{
e.Cancel = true;
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace CAFE
{
public partial class fTableManager : Form
{
public fTableManager()
{
InitializeComponent();
}
private void đăngXuấtToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void thôngTinCáNhânToolStripMenuItem_Click(object sender, EventArgs e)
{
fAccountProfile f = new fAccountProfile();
f.ShowDialog();
}
private void adminToolStripMenuItem_Click(object sender, EventArgs e)
{
fAdmin f = new fAdmin();
f.ShowDialog();
}
}
}
Đã được chỉnh sửa lần cuối bởi ninhvantung : 10-02-2023 lúc 08:16 PM. Lý do: thêm chữ vì thiếu sót