private void addbtn_Click(object sender, EventArgs e)
{
SqlCommand cmd,read1;
SqlConnection con=new SqlConnection("Data Source=name;Initial Catalog=month;Integrated Security=True");
con.Open();
cmd=new SqlCommand("Insert into grossarynames values(' "+glisttxt.Text+" ')",con);
cmd.ExecuteNonQuery();
read1=new SqlCommand("Select * from grossarynames,con);
SqlDataReader dr=read1.executeReader();
DataTable dt=new Datatable();
dt.Load(dr);
datagridview.source=dt;
}
check code