Sunday 17 November 2013

Sql database Conectivity , C# Sql Connection, .net , Mysql Connection , Sql Connection, easy Database connectivity, Quick Database Connectivity, Access Database Connection in C# .net , mysql .net connection, short cut sql connectivity in c#


Database connection is an integral part of any application 
I will Show you the easiest and shortest way to connect your  
  application with database
•You can easily create your database centric application with less , short , minimum code
•You can connect your .net (C# or CSharp) application with SQL server ,MySql , Microsoft Access

Follow the Video Tutorial here


 
Follow the below mentioned Steps
(2) Add the reference of DBcon.dll in your Project 
      
  (i) Right click on project in Solution Explorer -> Add Reference
           
 (ii) Go to Browse Tab->select DBcon.dll you have  downloaded->click OK



  (3) Start Doing Database Connection
  1. using DBCon ; //include this namespace in forms 
  2. Initialize Connection, you need to do this only once in your application

    DBConClass dc;// create this obect in your form class 

    Go to Load event of First form in your application

    1.         private void Form1_Load(object sender, EventArgs e)
              {
                 //Establishing Connection
                 //This is one time Process in Entire Project . You need to do this only
                //one time in your project

                  dc = new DBConClass();
                  dc.setSQLConnection(".", "test", "sa", "sql");          
                 
              }
    4. Do Your Database operation here after,
      private void button1_Click(object sender, EventArgs e)
        {
            //Here after Whenever you need database operation Only need to do as follows

            string query = "Insert into Student values("+txtRoll.Text+",'"+txtName.Text+"')";
            dc = new DBConClass();
            int res = dc.ExecNonQuery(query);
        }

   5.Fetch data in  Form 2 
   DBConClass dcon;

      private void button1_Click(object sender, EventArgs e)
        {
            string query = "Select * From Student";
            dcon = new DBConClass();
            dcon.ExecuteQuery(query);
          

            try
            {
                dataGridView1.DataSource = dcon.dtable;
            }
            catch
            {
           
            }


        }



Tags
Connect Application With Database | Sql Connectivity | C# With SQL | MySql Connectivity | Transaction in SQL with .net |