SlideShare a Scribd company logo
1 of 2
namespace canbo
{

    public partial class Form1 : Form
    {
        private OleDbConnection mycon;
        public Form1()
        {
            InitializeComponent();
            mycon = new
OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:thuchanhCanbo.mdb");
            {
                string sql = @"Select * from tblDonvi";
                mycon.Open();
                OleDbDataAdapter da = new OleDbDataAdapter(sql, mycon);
                DataSet ds = new DataSet();
                da.Fill(ds, "tblDonvi");
                DataTable dtEx = ds.Tables["tblDonvi"];
                mycon.Close();
                this.madvcb.DataSource = dtEx;
                madvcb.DisplayMember = "TenDV";
                maDVTextBox.DataBindings.Add("text", dtEx, "TenDV");
            }

            {
                  string sl = @"Select * from nguyennhan";
                  mycon.Open();
                  OleDbDataAdapter d = new OleDbDataAdapter(sl, mycon);
                  DataSet s = new DataSet();
                  d.Fill(s, "nguyennhan");
                  DataTable dt = s.Tables["nguyennhan"];
                  mycon.Close();
                  this.soluongcb.DataSource = dt;
                  soluongcb.DisplayMember = "nguyennhan";
                  textBox1.DataBindings.Add("text", dt, "nguyennhan");
            }
        }

        private void tblCanBoBindingNavigatorSaveItem_Click(object sender,
EventArgs e)
        {
             /*
             this.Validate();
             this.tblCanBoBindingSource.EndEdit();
             this.tableAdapterManager.UpdateAll(this.canboDataSet);
             */
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the
'canboDataSet.nguyennhan' table. You can move, or remove it, as needed.
            this.nguyennhanTableAdapter.Fill(this.canboDataSet.nguyennhan);
            // TODO: This line of code loads data into the
'canboDataSet.tblCanBo' table. You can move, or remove it, as needed.
            this.tblCanBoTableAdapter.Fill(this.canboDataSet.tblCanBo);

        }
private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                OleDbCommand cmd = new OleDbCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "Insert into
tblCanBo(MaCB,MaDV,TenCB,DiaChi)values('" +
Convert.ToDateTime(dateTimePicker1.Text).ToString("MM/dd/yyyy") + "','" +
maDVTextBox.Text + "','" + tenCBTextBox.Text + "','" + diaChiTextBox.Text +
"')";
                cmd.Connection = mycon;
                mycon.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("da them thanh cong", "thông bao");
            }
            catch
            {
                MessageBox.Show("bạn chưa nhập hoăc trùng tên", "Thông
báo");
                mycon.Close();
            }

         }

         private void button2_Click(object sender, EventArgs e)
         {
             maCBTextBox.Text = "";
             maDVTextBox.Text ="";
             tenCBTextBox.Text ="";
             diaChiTextBox.Text = "";
         }

         private void madvcb_SelectedIndexChanged(object sender, EventArgs
e)
         {

         }

        private void soluongcb_SelectedIndexChanged(object sender,
EventArgs e)
        {


         }
     }
}
Chay chu tren form :

public int i = 1;
        private void timer1_Tick(object sender, EventArgs e)
        {
            label2.Left += i;
            if (label2.Left >= this.Width - label2.Width || label2.Left <=
0)
                i = -i;
        }

More Related Content

What's hot

Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJsHenri Binsztok
 
New text document
New text documentNew text document
New text documentTam Ngo
 
MVVM e Caliburn Micro for Windows Phone applications
MVVM e Caliburn Micro for Windows Phone applicationsMVVM e Caliburn Micro for Windows Phone applications
MVVM e Caliburn Micro for Windows Phone applicationsMatteo Pagani
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventasDAYANA RETO
 
Codes
CodesCodes
CodesOSit3
 
The love child of Android and .NET: App development with Xamarin
The love child of Android and .NET: App development with XamarinThe love child of Android and .NET: App development with Xamarin
The love child of Android and .NET: App development with XamarinLorenz Cuno Klopfenstein
 
AI Gaming - Azure Cognitive Services
AI Gaming - Azure Cognitive ServicesAI Gaming - Azure Cognitive Services
AI Gaming - Azure Cognitive ServicesAnweshBudhathoki
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDbsliimohara
 
Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3Helmita putri
 
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Nikolay Rumyantsev
 
Restful services-slides
Restful services-slidesRestful services-slides
Restful services-slidesMasterCode.vn
 
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นคลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นFinian Nian
 

What's hot (20)

Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJs
 
New text document
New text documentNew text document
New text document
 
MVVM e Caliburn Micro for Windows Phone applications
MVVM e Caliburn Micro for Windows Phone applicationsMVVM e Caliburn Micro for Windows Phone applications
MVVM e Caliburn Micro for Windows Phone applications
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
 
Codes
CodesCodes
Codes
 
Mobile Web 5.0
Mobile Web 5.0Mobile Web 5.0
Mobile Web 5.0
 
The love child of Android and .NET: App development with Xamarin
The love child of Android and .NET: App development with XamarinThe love child of Android and .NET: App development with Xamarin
The love child of Android and .NET: App development with Xamarin
 
AI Gaming - Azure Cognitive Services
AI Gaming - Azure Cognitive ServicesAI Gaming - Azure Cognitive Services
AI Gaming - Azure Cognitive Services
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDb
 
Fetch data from form
Fetch data from formFetch data from form
Fetch data from form
 
C#
C#C#
C#
 
Form1.vb
Form1.vbForm1.vb
Form1.vb
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
Bulk copy
Bulk copyBulk copy
Bulk copy
 
Everyday's JS
Everyday's JSEveryday's JS
Everyday's JS
 
Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3Laporan tugas mata kuliah pbo yg ke 3
Laporan tugas mata kuliah pbo yg ke 3
 
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
Применение шаблона проектирования MVVM при разработке архитектуры Windows Pho...
 
Using MongoDB
Using MongoDBUsing MongoDB
Using MongoDB
 
Restful services-slides
Restful services-slidesRestful services-slides
Restful services-slides
 
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นคลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
 

Similar to Quanlycanbo

Similar to Quanlycanbo (20)

Ditec esoft C# project
Ditec esoft C# projectDitec esoft C# project
Ditec esoft C# project
 
Ditec esoft C# project
Ditec esoft C# project Ditec esoft C# project
Ditec esoft C# project
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
bai giai de LTWINForm.docx
bai giai de LTWINForm.docxbai giai de LTWINForm.docx
bai giai de LTWINForm.docx
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
 
Codeofdatabase
CodeofdatabaseCodeofdatabase
Codeofdatabase
 
Id32
Id32Id32
Id32
 
Borrar
BorrarBorrar
Borrar
 
C# Generics
C# GenericsC# Generics
C# Generics
 
MaintainStaffTable
MaintainStaffTableMaintainStaffTable
MaintainStaffTable
 
16 18
16 1816 18
16 18
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdf
 
mediator
mediatormediator
mediator
 
mediator2
mediator2mediator2
mediator2
 
Spring data access
Spring data accessSpring data access
Spring data access
 
Public class form1
Public class form1Public class form1
Public class form1
 
Public class form1
Public class form1Public class form1
Public class form1
 
Working With JQuery Part1
Working With JQuery Part1Working With JQuery Part1
Working With JQuery Part1
 
This is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdfThis is a C# project . I am expected to create as this image shows. .pdf
This is a C# project . I am expected to create as this image shows. .pdf
 

Quanlycanbo

  • 1. namespace canbo { public partial class Form1 : Form { private OleDbConnection mycon; public Form1() { InitializeComponent(); mycon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:thuchanhCanbo.mdb"); { string sql = @"Select * from tblDonvi"; mycon.Open(); OleDbDataAdapter da = new OleDbDataAdapter(sql, mycon); DataSet ds = new DataSet(); da.Fill(ds, "tblDonvi"); DataTable dtEx = ds.Tables["tblDonvi"]; mycon.Close(); this.madvcb.DataSource = dtEx; madvcb.DisplayMember = "TenDV"; maDVTextBox.DataBindings.Add("text", dtEx, "TenDV"); } { string sl = @"Select * from nguyennhan"; mycon.Open(); OleDbDataAdapter d = new OleDbDataAdapter(sl, mycon); DataSet s = new DataSet(); d.Fill(s, "nguyennhan"); DataTable dt = s.Tables["nguyennhan"]; mycon.Close(); this.soluongcb.DataSource = dt; soluongcb.DisplayMember = "nguyennhan"; textBox1.DataBindings.Add("text", dt, "nguyennhan"); } } private void tblCanBoBindingNavigatorSaveItem_Click(object sender, EventArgs e) { /* this.Validate(); this.tblCanBoBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.canboDataSet); */ } private void Form1_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'canboDataSet.nguyennhan' table. You can move, or remove it, as needed. this.nguyennhanTableAdapter.Fill(this.canboDataSet.nguyennhan); // TODO: This line of code loads data into the 'canboDataSet.tblCanBo' table. You can move, or remove it, as needed. this.tblCanBoTableAdapter.Fill(this.canboDataSet.tblCanBo); }
  • 2. private void button1_Click(object sender, EventArgs e) { try { OleDbCommand cmd = new OleDbCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "Insert into tblCanBo(MaCB,MaDV,TenCB,DiaChi)values('" + Convert.ToDateTime(dateTimePicker1.Text).ToString("MM/dd/yyyy") + "','" + maDVTextBox.Text + "','" + tenCBTextBox.Text + "','" + diaChiTextBox.Text + "')"; cmd.Connection = mycon; mycon.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("da them thanh cong", "thông bao"); } catch { MessageBox.Show("bạn chưa nhập hoăc trùng tên", "Thông báo"); mycon.Close(); } } private void button2_Click(object sender, EventArgs e) { maCBTextBox.Text = ""; maDVTextBox.Text =""; tenCBTextBox.Text =""; diaChiTextBox.Text = ""; } private void madvcb_SelectedIndexChanged(object sender, EventArgs e) { } private void soluongcb_SelectedIndexChanged(object sender, EventArgs e) { } } } Chay chu tren form : public int i = 1; private void timer1_Tick(object sender, EventArgs e) { label2.Left += i; if (label2.Left >= this.Width - label2.Width || label2.Left <= 0) i = -i; }