Step 1: Form
Drag down a data GridView and a Button from the tool box.

Step 2: Code
Now, click on the Button (Load Button). And write this code.
private void Load_button_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("server = MUNESH;Database=datastore;UID=sa;Password=123;");
SqlCommand cmd = new SqlCommand("Select Eid as 'Employee Id', Name as 'Employee name' , surname as 'Employee surname' ,Age as 'Employee surname' from data1", con);
try
{
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;


Join the conversation! Your thoughts help the community grow.