.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

C# - Using BindingManagerBase

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

C# How To Use BindingManagerBase And MySql CommandBuilder


In This C# Tutorial We Will See How To Use BindingManagerBase To Insert Update Delete Search And Navigate Data From Database Using CSharp Programming Language And MySQL Database.


                                                                          Part 1

Part 2

Source Code :

using MySql.Data.MySqlClient;
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 Csharp_And_MySQL
{
    public partial class Using_DataBindings : Form
    {
        public Using_DataBindings()
        {
            InitializeComponent();
        }

        MySqlConnection connection = new MySqlConnection("datasource=localhost;port=3306;Initial Catalog ='test_db';username=root;password=");
        MySqlCommand command;
        MySqlDataAdapter adapter;
        DataTable table = new DataTable();
        BindingManagerBase managerBase;
        MySqlCommandBuilder builder;

        private void Using_DataBindings_Load(object sender, EventArgs e)
        {
            string query = "SELECT * FROM users";
            command = new MySqlCommand(query, connection);
            adapter = new MySqlDataAdapter(command);
            adapter.Fill(table);
            dataGridView1.DataSource = table;
            textBoxID.DataBindings.Add("text",table,"id");
            textBoxFName.DataBindings.Add("text", table, "fname");
            textBoxLName.DataBindings.Add("text", table, "lname");
            textBoxAge.DataBindings.Add("text", table, "age");

            managerBase = this.BindingContext[table];
        }

        private void BTN_FIRST_Click(object sender, EventArgs e)
        {
            managerBase.Position = 0;
        }

        private void BTN_NEXT_Click(object sender, EventArgs e)
        {
            managerBase.Position += 1;
        }

        private void BTN_PREVIOUS_Click(object sender, EventArgs e)
        {
            managerBase.Position -= 1;
        }

        private void BTN_LAST_Click(object sender, EventArgs e)
        {
            managerBase.Position = managerBase.Count;
        }

        private void BTN_NEW_Click(object sender, EventArgs e)
        {
            managerBase.AddNew();
        }

        private void BTN_INSERT_Click(object sender, EventArgs e)
        {
            managerBase.EndCurrentEdit();
            builder = new MySqlCommandBuilder(adapter);
            adapter.Update(table);
            MessageBox.Show("New User Added","New User",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }

        private void BTN_UPDATE_Click(object sender, EventArgs e)
        {
            managerBase.EndCurrentEdit();
            builder = new MySqlCommandBuilder(adapter);
            adapter.Update(table);
            MessageBox.Show("User Data Updated", "Edit User", MessageBoxButtons.OK, MessageBoxIcon.Information);
     
        }

        private void BTN_DELETE_Click(object sender, EventArgs e)
        {
            managerBase.RemoveAt(managerBase.Position);
            builder = new MySqlCommandBuilder(adapter);
            adapter.Update(table);
            MessageBox.Show("User Deleted", "Remove User", MessageBoxButtons.OK, MessageBoxIcon.Information);
     
        }
    }
}

=> OutPut :


C# Using BindingManagerBase


Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel C# - Using BindingManagerBase, Diterbitkan oleh scodeaplikasi pada Minggu, 28 Agustus 2016. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to