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 grid { public partial class Form1 : Form { public DataTable dtRaw = new DataTable(); public Form1() { InitializeComponent(); //Fill.Data(); } private void Form1_Load(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Server=KK-PC;Database=SampleDB;User id=sa;password=sa2008;"); string sql = "SELECT *FROM Emp_Details"; SqlCommand command = new SqlCommand(sql,conn); command.Connection = conn; DataTable data = new DataTable(); SqlDataAdapter Adapter = new SqlDataAdapter(command); Adapter.Fill(data); dataGridview.DataSource = data; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)