Posts

Showing posts from 2016

How To Backup MySql Database

Image
1.Create folder in D drive (folder name = blog )  2.Create Application 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 MySql.Data.MySqlClient; namespace blog {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         private void button1_Click(object sender, EventArgs e)         {             string conn = "server=localhost;user=root;password=;database=blog;charset=utf8";             string file = " D:\\blog\\blog.sql";             using (MySqlConnection con = new MySqlConnection(conn))             {                 using (MySqlCommand cmd = new MySqlCommand())                 {                     using (MySqlBackup mb = new MySqlBackup(cmd))            

C# Code For Beginners (Part 4)

Image
Update MySql Database Using Textbox 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 MySql.Data.MySqlClient; namespace Blog4 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         private void button1_Click(object sender, EventArgs e)         {             string con = "server=localhost;user id=root;password=;database=blog";             string query = "Update example set Item_Name = '"+textBox2.Text+"' where Item_Code = '"+textBox1.Text+"'";             MySqlConnection conn = new MySqlConnection(con);             MySqlCommand command = new MySqlCommand(query,conn);             MySqlDataReader reader;             conn.Open();             reader = command.ExecuteReader();             Messa

C# Code For Beginners (Part 3)

Image
1.  Add Items to Listbox from Textbox i. 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; namespace Blog3 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         private void button1_Click(object sender, EventArgs e)         {                                     listBox1.Items.Add(textBox1.Text +"                          "+textBox2.Text +"                          "+textBox3.Text);               }     } } output  ii. 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; namespace Blog3 {     public partial class Form1 : Form     {         public Form1()         {      

C# Code For Beginner (Part 2)

Image
1. Delete Item in Database using Textbox 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 MySql.Data.MySqlClient; namespace blog2 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         private void btndel_Click(object sender, EventArgs e)         {             string MyConnection2 = "server=localhost;user id=root;password=;database=blog";             string Query = "delete from example where Item_Code='" + this.tbdel.Text + "';";             MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);             MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2);             MySqlDataReader MyReader2;             MyConn2.Open();             MyReader2 = MyCommand2.ExecuteReader();        

C# Code For Beginners (Part 1)

Image
1. Add item to Textbox from Textbox 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 MySql.Data.MySqlClient; namespace Blog1 {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();         }         private void btnadd_Click(object sender, EventArgs e)         {             int code1 = int.Parse(tbcode1.Text);             tbcode2.Text=code1.ToString();             string name1= tbname1.Text;             tbname2.Text = name1;                   }     } } output 2. Add item to Datagridview from Datagridview 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 MySql.Data.MySqlClient; namespace Blog1

Normalization in DBMS: 1NF, 2NF and 3NF in Database

Normalization is a process of organizing the data in database to avoid anomalies of inserting, updating and deleting. After this method, a large table becomes small tables and defines relationships between them to identify the organizing data clearly. Normalization was developed by IBM researcher E.F.Codd in the 1970 s. Example: Emp_ID Emp Name Emp_Add DOB Age Emp_Dep 101 Anne London 1991.02.21 25 D001 101 Anne London 1991.02.21 25 D002 123 Jack Paris 1993.06.30 23 D890 166 Ola Rio 1992.05.06 24 D900 166 Ola Rio 1992.05.06 24 D004 We have to face these problems because the above table is not normalized. Update anomaly – There are two rows for employee Anne because she works in two departments in the company. If we want to change her address, we have to update