c# code for datatable and dataset function in dot net



This is A C# Practice code:
        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 System.Data.SqlClient;
        namespace dataentry
        {
            public partial class Difference : Form
            {
                public Difference()
                {
                    InitializeComponent();
                }
                SqlConnection CON = new SqlConnection("Data Source=.;Initial Catalog=DATAENTRY;Integrated Security=True;Pooling=False");

                DataTable TTT = new DataTable();
                DataSet SSS = new DataSet();
                private void Difference_Load(object sender, EventArgs e)
                {
                    
                }

                private void button1_Click(object sender, EventArgs e)
                {
                    SqlDataAdapter asdf = new SqlDataAdapter("select * from Register",CON);
                    asdf.Fill(TTT);
                    dataGridView1.DataSource = TTT;


                    SqlDataAdapter Data1 = new SqlDataAdapter("select * from Register", CON);
                    asdf.Fill(SSS, "Register");
                    dataGridView2.DataSource = SSS.Tables[0];


                    SqlDataAdapter Data2 = new SqlDataAdapter("select * from Register", CON);
                    asdf.Fill(SSS, "Register");
                    dataGridView3.DataSource = SSS.Tables[0];
                }
            }
        }

Video For Result:



Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Facebook Comment