SqlCommand cmd;
SqlConnection con;
SqlDataAdapter da;
DataSet ds;
private void button1_Click(object sender, EventArgs e)
{
con = new SqlConnection("your_database_connection_sting");
cmd =new SqlCommand ("select * from emp", con);
da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
comboBox1.Items.Add(ds.Tables[0].Rows[i][0] + " " + ds.Tables[0].Rows[i][1] + " " + ds.Tables[0].Rows[i][2]);
}
}
SqlConnection con;
SqlDataAdapter da;
DataSet ds;
private void button1_Click(object sender, EventArgs e)
{
con = new SqlConnection("your_database_connection_sting");
cmd =new SqlCommand ("select * from emp", con);
da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
comboBox1.Items.Add(ds.Tables[0].Rows[i][0] + " " + ds.Tables[0].Rows[i][1] + " " + ds.Tables[0].Rows[i][2]);
}
}