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 WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); string strCon = "Data Source=ahxh-02;Initial Catalog=CarsInsurance;Integrated Security=True"; SqlConnection connection = new SqlConnection(strCon); connection.Open(); string strSql = "select * from dbo.CarsInformation"; SqlDataAdapter adapter = new SqlDataAdapter(strSql, connection); adapter.Fill(ds); DataTable dt = ds.Tables[0]; DataTable dt1 = new DataTable("CarInsurance"); string strSql1 = "select * from dbo.CarInsurance"; SqlDataAdapter adapter1 = new SqlDataAdapter(strSql1, connection); adapter1.Fill(dt1); ds.Tables.Add(dt1); this.dataGridView1.DataSource = ds.Tables[0]; this.dataGridView2.DataSource = ds.Tables[1]; this.dataGridView3.DataSource = dt1; } } }