using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace gridview
{
   
    public partial class Form1 : Form
    {
        int m = 0;
        public Form1()
        {
            InitializeComponent();
        }
       
        private void Form1_Load(object sender, EventArgs e)
        {
            SqlConnection cn = new SqlConnection("Data Source=.;Initial Catalog=master;Integrated Security=True");
            cn.Open();
            SqlCommand cm = new SqlCommand("select * from data_customer",cn);
            SqlDataAdapter da = new SqlDataAdapter();
            da.SelectCommand = cm;
            DataSet ds = new DataSet();
            da.Fill(ds);
            m = ds.Tables[0].Rows.Count;
           // dataGridView1.DataSource = ds.Tables[0];
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                dataGridView1.Rows.Add();
                dataGridView1[0, i].Value = ds.Tables[0].Rows[i][0].ToString();
                dataGridView1[1, i].Value = ds.Tables[0].Rows[i][1].ToString();
                dataGridView1[2, i].Value = ds.Tables[0].Rows[i][2].ToString();

            }
            cn.Close();
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection cn = new SqlConnection("Data Source=.;Initial Catalog=master;Integrated Security=True");
            cn.Open();
            for (int i = m; i < dataGridView1.Rows.Count-1; i++)
            {
                SqlCommand cm = new SqlCommand("insert into data_customer(cust_id,cust_name,cust_address) values(" + dataGridView1[0, i].Value + ",'" + dataGridView1[1, i].Value + "','" + dataGridView1[2, i].Value + "')", cn);
                cm.ExecuteNonQuery();
            }

 

            MessageBox.Show("data inserted");
            cn.Close();
           
        }

        private void button2_Click(object sender, EventArgs e)
        {
          
        }
    }
}

Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement
Corporate Services
  Web Design and development
  Web Promotion (SEO)
  Multimedia/CD Presentation
  Software development

  E.Commerce

Training@balujalabs

  Software Courses
  Hardware Courses
  Networking.Courses
  Mobile Repairing Courses
  UGC Degrees
Student Corner
 Programming & Projects
 Placement Papers
 Project Ideas
 Synopsis Ideas

  Franchise Section

 Administrator
Franchise Inquiry
 
 

//PROGRAMM TO INSERT THROUGH DATAGRIDVIEW

 

 

 

 

 

 

 






1

// PROGRAM FOR FORM DISPLAY AND ADDITION AND GREATER IN WO NUMBER

2 //PROGRAM TO  USE CASE -FOR – AND  DO LOOP
3

// PROGRAM TO USE FUNCTION OF CLASS AND CALL IN FORM WINDOW

4 //PROGRAMM TO INSERT THROUGH DATAGRIDVIEW
5 //PROGRAMM TO CHECK DUPLICATE VALUE FROM TABLE
6

//PROGRAMM TO WORK ON PROGRESS BAR

7

//PROGRAMM TO CHEAK VALIDATION ON TEXTBOX AND USE OF METHODS AND HOW TO WORK ON ACCESS DATABASE DISPLAY AND HOW TO WORK ON CLASSLIBRARY

 


     
Home       |      About Us       |     Portfolio       |      Services       |       Career        |    Contact Us       |      Industrial Training        |      Achievement