Chào các bạn! Vì nhiều lý do từ nay Truyen2U chính thức đổi tên là Truyen247.Pro. Mong các bạn tiếp tục ủng hộ truy cập tên miền mới này nhé! Mãi yêu... ♥

FrmNhapXe

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Data.SqlClient;

namespace Qlxe

{

public partial class FrmNhapXe : Form

{

public FrmNhapXe()

{

InitializeComponent();

KetNoi.MoKetNoi();

}

//public static DataSet ds1;

DataTable dt;

private void FrmNhapXe_Load(object sender, EventArgs e)

{

KetNoi.MoKetNoi();

dt = KetNoi.GetBang("xe");

bindingSource1.DataSource = dt;

dataGridView1.DataSource = bindingSource1;

txtmx.DataBindings.Add("text", bindingSource1, "maxe");

txtsl.DataBindings.Add("text", bindingSource1, "soluong");

txttx.DataBindings.Add("text", bindingSource1, "tenxe");

}

private void bttthem_Click(object sender, EventArgs e)

{

bindingSource1.AddNew();

}

private void bttxoa_Click(object sender, EventArgs e)

{

bindingSource1.RemoveCurrent();

}

private void bttsua_Click(object sender, EventArgs e)

{

}

private void bttluu_Click(object sender, EventArgs e)

{

//KetNoi.MoKetNoi();

//KetNoi.da.UpdateCommand = KetNoi.cmb.GetUpdateCommand();

bindingSource1.EndEdit();

KetNoi.da.Update((DataTable)bindingSource1.DataSource);

}

private void btttk_Click(object sender, EventArgs e)

{

string st = string.Format("tenxe like '%{0}%'", txttk.Text);

bindingSource1.Filter = st;

if (bindingSource1.Count == 0)

MessageBox.Show("Khong tim thay");

}

}

}

Bạn đang đọc truyện trên: Truyen247.Pro

Tags: