Posts

Showing posts from December, 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