private void btnshow_Click(object sender, EventArgs e) { string connStr = "provider=Microsoft.Jet.OLEDB.4.0;Data Source='c:\\KBE\\solid piston1.xls';Extended Properties=Excel 8.0;"; OleDbConnection MyConnection; DataSet ds1; OleDbDataAdapter MyCommand1; MyConnection = new OleDbConnection(connStr); MyCommand1 = new OleDbDataAdapter("select * from [INPUT$]", MyConnection); ds1 = new System.Data.DataSet(); MyCommand1.Fill(ds1); DataTable dt1 = new DataTable(); dt1 = ds1.Tables[0]; cbf.Items.Insert(0, dt1.Rows[1]["Value"].ToString()); textBox1.Text = dt1.Rows[2]["Value"].ToString(); textBox2.Text = dt1.Rows[3]["Value"].ToString(); comboBox2.Text = dt1.Rows[6]["Value"].ToString();
comboBox2.DataSource=dt1 comboBox2.DisplayMember = "Field1"; comboBox2.ValueMember = "Field2";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)