Create a windows form to show stored data in sql
server database on form using GridView control.
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 WindowsFormsshowdataGridview
{
public
partial class Form1 : Form
{
SqlConnection con = new SqlConnection("Data Source=.;Initial
Catalog=Atif;Integrated Security=True;Pooling=False");
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
public
Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
ds.Clear();
string str = "select * from
Employ";
da = new SqlDataAdapter(str, con);
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
}
}
}