Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
+9
Ami
Virus
tuyenvht
khongxacdinh
vanduc
ThuHang
nanaly
kiehuy
nguyenduc
13 posters
Trang 2 trong tổng số 2 trang
Trang 2 trong tổng số 2 trang • 1, 2
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
Trời ơi sao không thấy ai post code lên cho bà con tham khảo nhỉ.
dayttin- Góp sức
- Tổng số bài gửi : 68
Join date : 23/09/2009
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
Hi, dayttin
Bạn đang làm tới phần nào, ghi danh sách ra đi, có cái mình làm tới rồi, nhưng cũng có cài làm chưa xong.
Bạn đưa ra 1 cái cụ thể thì mọi người sẽ bàn luận về nó chính xác hơn. Chứ để chung chung vậy, mình cũng bó tay, vì nó nhiều lắm!
Thân,
Bạn đang làm tới phần nào, ghi danh sách ra đi, có cái mình làm tới rồi, nhưng cũng có cài làm chưa xong.
Bạn đưa ra 1 cái cụ thể thì mọi người sẽ bàn luận về nó chính xác hơn. Chứ để chung chung vậy, mình cũng bó tay, vì nó nhiều lắm!
Thân,
ThuHang- Cống hiến
- Tổng số bài gửi : 193
Join date : 25/09/2009
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
Cảm ơn nhé.
Mình làm như thế này, bạn kiểm tra xem..
public partial class Themsanpham : Form
{
public Themsanpham()
{
InitializeComponent();
Insert();
}
public DataSet ds = new DataSet();
public SqlDataAdapter sda = new SqlDataAdapter();
private BindingManagerBase bm;
private void Insert()
{
SqlConnection sc = new SqlConnection(
"server=DAY-PC;database=QuanLyBanHang;uid=sa;pwd=sa");
sc.Open();
SqlCommand scmd = new SqlCommand(
"select masp,tensp,malsp from SanPham ", sc);
sda.SelectCommand = scmd;
sda.Fill(ds, "sp");
SqlCommand scmd1 = new SqlCommand("select*from LoaiSanPham",sc);
sda.SelectCommand = scmd1;
sda.Fill(ds, "lsp");
SqlCommand scmdu = new SqlCommand(
"insert into SanPham ( masp,tesp,malsp)" + " values (@masp,@tensp,@malsp)", sc);
SqlParameter imasp = new SqlParameter(
"@masp", SqlDbType.NVarChar,10, "masp");
SqlParameter itensp = new SqlParameter(
"@tensp", SqlDbType.NVarChar,50, "tensp");
SqlParameter imalsp = new SqlParameter(
"@malsp", SqlDbType.NVarChar,10, "malsp");
scmdu.Parameters.AddRange(new SqlParameter[] { imasp, itensp, imalsp });
sda.InsertCommand = scmdu;
sc.Close();
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "sp";
bm = this.BindingContext[ds, "sp"];
textBox1.DataBindings.Add(
"text", ds, "sp.masp");
textBox2.DataBindings.Add(
"text", ds, "sp.tensp");
comboBox1.DataSource = ds;
comboBox1.DisplayMember = "lsp.malsp";
comboBox1.ValueMember = "lsp.malsp";
comboBox1.DataBindings.Add(
"SelectedValue", ds, "sp.malsp");
}
DataRowView newrow;
private void button1_Click(object sender, EventArgs e)
{
bm.AddNew();
newrow = (DataRowView)bm.Current;
}
}
}
....khi insert vào thì dữ liệu củng vào form nhưng không xuống database mọi người giúp đỡ.
Mình làm như thế này, bạn kiểm tra xem..
public partial class Themsanpham : Form
{
public Themsanpham()
{
InitializeComponent();
Insert();
}
public DataSet ds = new DataSet();
public SqlDataAdapter sda = new SqlDataAdapter();
private BindingManagerBase bm;
private void Insert()
{
SqlConnection sc = new SqlConnection(
"server=DAY-PC;database=QuanLyBanHang;uid=sa;pwd=sa");
sc.Open();
SqlCommand scmd = new SqlCommand(
"select masp,tensp,malsp from SanPham ", sc);
sda.SelectCommand = scmd;
sda.Fill(ds, "sp");
SqlCommand scmd1 = new SqlCommand("select*from LoaiSanPham",sc);
sda.SelectCommand = scmd1;
sda.Fill(ds, "lsp");
SqlCommand scmdu = new SqlCommand(
"insert into SanPham ( masp,tesp,malsp)" + " values (@masp,@tensp,@malsp)", sc);
SqlParameter imasp = new SqlParameter(
"@masp", SqlDbType.NVarChar,10, "masp");
SqlParameter itensp = new SqlParameter(
"@tensp", SqlDbType.NVarChar,50, "tensp");
SqlParameter imalsp = new SqlParameter(
"@malsp", SqlDbType.NVarChar,10, "malsp");
scmdu.Parameters.AddRange(new SqlParameter[] { imasp, itensp, imalsp });
sda.InsertCommand = scmdu;
sc.Close();
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "sp";
bm = this.BindingContext[ds, "sp"];
textBox1.DataBindings.Add(
"text", ds, "sp.masp");
textBox2.DataBindings.Add(
"text", ds, "sp.tensp");
comboBox1.DataSource = ds;
comboBox1.DisplayMember = "lsp.malsp";
comboBox1.ValueMember = "lsp.malsp";
comboBox1.DataBindings.Add(
"SelectedValue", ds, "sp.malsp");
}
DataRowView newrow;
private void button1_Click(object sender, EventArgs e)
{
bm.AddNew();
newrow = (DataRowView)bm.Current;
}
}
}
....khi insert vào thì dữ liệu củng vào form nhưng không xuống database mọi người giúp đỡ.
dayttin- Góp sức
- Tổng số bài gửi : 68
Join date : 23/09/2009
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
@@dayttin:
-Bạn tham khảo cuốn Lập trình CSDL và Visual source safe của p Hữu Khang chương 2,3 có nói rõ phần này(làm thế nào để update databse với lớp k kết nối dataset,datatable) sẽ hiểu đầy đủ hơn, ngoài ra còn có hướng dẫn thêm về thao tác trên DatagridView.
-Bạn tham khảo cuốn Lập trình CSDL và Visual source safe của p Hữu Khang chương 2,3 có nói rõ phần này(làm thế nào để update databse với lớp k kết nối dataset,datatable) sẽ hiểu đầy đủ hơn, ngoài ra còn có hướng dẫn thêm về thao tác trên DatagridView.
itlinh- Góp sức
- Tổng số bài gửi : 84
Join date : 27/09/2009
Đến từ : HCM
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
dayttin đã viết:Cảm ơn nhé.
Mình làm như thế này, bạn kiểm tra xem..
public partial class Themsanpham : Form
{
public Themsanpham()
{
InitializeComponent();
Insert();
}
public DataSet ds = new DataSet();
public SqlDataAdapter sda = new SqlDataAdapter();
private BindingManagerBase bm;
private void Insert()
{
SqlConnection sc = new SqlConnection(
"server=DAY-PC;database=QuanLyBanHang;uid=sa;pwd=sa");
sc.Open();
SqlCommand scmd = new SqlCommand(
"select masp,tensp,malsp from SanPham ", sc);
sda.SelectCommand = scmd;
sda.Fill(ds, "sp");
SqlCommand scmd1 = new SqlCommand("select*from LoaiSanPham",sc);
sda.SelectCommand = scmd1;
sda.Fill(ds, "lsp");
SqlCommand scmdu = new SqlCommand(
"insert into SanPham ( masp,tesp,malsp)" + " values (@masp,@tensp,@malsp)", sc);
SqlParameter imasp = new SqlParameter(
"@masp", SqlDbType.NVarChar,10, "masp");
SqlParameter itensp = new SqlParameter(
"@tensp", SqlDbType.NVarChar,50, "tensp");
SqlParameter imalsp = new SqlParameter(
"@malsp", SqlDbType.NVarChar,10, "malsp");
scmdu.Parameters.AddRange(new SqlParameter[] { imasp, itensp, imalsp });
sda.InsertCommand = scmdu;
sc.Close();
dataGridView1.DataSource = ds;
dataGridView1.DataMember = "sp";
bm = this.BindingContext[ds, "sp"];
textBox1.DataBindings.Add(
"text", ds, "sp.masp");
textBox2.DataBindings.Add(
"text", ds, "sp.tensp");
comboBox1.DataSource = ds;
comboBox1.DisplayMember = "lsp.malsp";
comboBox1.ValueMember = "lsp.malsp";
comboBox1.DataBindings.Add(
"SelectedValue", ds, "sp.malsp");
}
DataRowView newrow;
private void button1_Click(object sender, EventArgs e)
{
bm.AddNew();
newrow = (DataRowView)bm.Current;
}
}
}
....khi insert vào thì dữ liệu củng vào form nhưng không xuống database mọi người giúp đỡ.
Hi, dayttin
Bạn cho mình hỏi, bạn đã gán giá trị bên ngoài vào biến chưa?
vd:
SqlCommand scmdu = new SqlCommand(
"insert into SanPham ( masp,tesp,malsp)" + " values (@masp,@tensp,@malsp)", sc);
SqlParameter imasp = new SqlParameter(
"@masp", SqlDbType.NVarChar,10, "masp");
SqlParameter itensp = new SqlParameter(
"@tensp", SqlDbType.NVarChar,50, "tensp");
SqlParameter imalsp = new SqlParameter(
"@malsp", SqlDbType.NVarChar,10, "malsp");
http://imasp.Value=textBox1.Text;
http://itensp.Value=textBox2.Text;
http://imalsp.Value=comboBox1.SelectedValue;
http://scmdu.Parameters.Add(imasp);
http://scmdu.Parameters.Add(itensp);
http://scmdu.Parameters.Add(imalsp);
scmdu.Parameters.AddRange(new SqlParameter[] { imasp, itensp, imalsp });
sda.InsertCommand = scmdu;
sc.Close();
ThuHang- Cống hiến
- Tổng số bài gửi : 193
Join date : 25/09/2009
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
[quote="ThuHang"]
http://imasp.Value=textBox1.Text;
http://itensp.Value=textBox2.Text;
http://imalsp.Value=comboBox1.SelectedValue;
http://scmdu.Parameters.Add(imasp);
http://scmdu.Parameters.Add(itensp);
http://scmdu.Parameters.Add(imalsp);
Mình chưa gán các giá trịdayttin đã viết:Cảm ơn nhé.
Mình làm như thế này, bạn kiểm tra xem..
public partial class Themsanpham : Form
{
http://imasp.Value=textBox1.Text;
http://itensp.Value=textBox2.Text;
http://imalsp.Value=comboBox1.SelectedValue;
http://scmdu.Parameters.Add(imasp);
http://scmdu.Parameters.Add(itensp);
http://scmdu.Parameters.Add(imalsp);
scmdu.Parameters.AddRange(new SqlParameter[] { imasp, itensp, imalsp });
sda.InsertCommand = scmdu;
sc.Close();
http://imasp.Value=textBox1.Text;
http://itensp.Value=textBox2.Text;
http://imalsp.Value=comboBox1.SelectedValue;
http://scmdu.Parameters.Add(imasp);
http://scmdu.Parameters.Add(itensp);
http://scmdu.Parameters.Add(imalsp);
dayttin- Góp sức
- Tổng số bài gửi : 68
Join date : 23/09/2009
Re: Đề tài hết môn Hệ quản trị cơ sở dữ liệu 2
Các bạn nào có đề tài số 1 cho mình xin. Cám ơn các bạn nhiều. Mình đang cần phần load hình.
lehoang925- Tổng số bài gửi : 1
Join date : 01/11/2010
Trang 2 trong tổng số 2 trang • 1, 2
Similar topics
» cần tài liệu quản trị học và quản trị nguần nhân lực
» Tài liệu ôn tập Quản trị học
» Có điểm thi môn Hệ quản trị cơ sở dữ liệu 2.
» Tài liêu tham khảo Quản Trị Học
» Tai lieu tham khao mon He Thong Thong Tin Quan ly
» Tài liệu ôn tập Quản trị học
» Có điểm thi môn Hệ quản trị cơ sở dữ liệu 2.
» Tài liêu tham khảo Quản Trị Học
» Tai lieu tham khao mon He Thong Thong Tin Quan ly
Trang 2 trong tổng số 2 trang
Permissions in this forum:
Bạn không có quyền trả lời bài viết
|
|
10/12/2020, 01:06 by Ti3uThucodon93
» Tiểu thuyết : Yêu anh là sai lầm của cuộc đời em
24/2/2019, 11:49 by Ti3uThucodon93
» Tiểu thuyết : Yêu sai thời điểm
23/2/2019, 16:39 by Ti3uThucodon93
» Thơ Trung Quốc !
15/10/2018, 10:05 by Ti3uThucodon93
» Câu nói hay !
22/1/2017, 15:59 by Ti3uThucodon93
» Thơ tình dài !
15/11/2016, 11:45 by Ti3uThucodon93
» Thơ 4 câu !
1/9/2016, 16:14 by Ti3uThucodon93
» Thơ hài hước !
9/8/2016, 09:04 by Ti3uThucodon93
» Cách chữa trị bệnh hôi nách dành cho sinh viên
30/7/2016, 16:02 by thammybacsihathanh