SqlConnection conn = new SqlConnection("server=.;database=RestOL;uid=sa;pwd=123456;");
conn.Open();
SqlCommand sql = new SqlCommand("select * from Dishes ", conn);
//有6列
SqlDataAdapter sda = new SqlDataAdapter(sql);
DataSet ds = new DataSet();
sda.Fill(ds);
int n = ds.Tables[0].Rows.Count;
for (int i = 0; i < n; i++)
{
this.Image1.ImageUrl = ds.Tables[0].Rows[i][0].ToString();
this.Label1.Text = ds.Tables[0].Rows[i][1].ToString();
this.Lable2.Text = ds.Tables[0].Rows[i][2].ToString();
this.Lable3.Text= ds.Tables[0].Rows[i][3].ToString();
this.Lable4.Text= ds.Tables[0].Rows[i][4].ToString();
this.Lable5.Text = ds.Tables[0].Rows[i][5].ToString();
}
conn.Close();