try { AutoCompleteStringCollection namescolln = new AutoCompleteStringCollection(); SqlConnection myconn = new SqlConnection("Data Source=ACER-PC\\SQLEXPRESS;Initial Catalog=CSM;Integrated Security=True"); myconn.Open(); SqlCommand cmnd = myconn.CreateCommand(); DataTable dt = new DataTable(); SqlDataAdapter sda0 = new SqlDataAdapter("select * from dbo.bill where prod_id='" + this.textBox2.Text + "';", myconn); sda0.Fill(dt); textBox1.Text = dt.Rows[0].ItemArray[1].ToString(); textBox3.Text = dt.Rows[0].ItemArray[2].ToString(); textBox4.Text = dt.Rows[0].ItemArray[3].ToString(); textBox5.Text = dt.Rows[0].ItemArray[4].ToString(); textBox6.Text = dt.Rows[0].ItemArray[5].ToString(); SqlDataAdapter sda1 = new SqlDataAdapter("select * from dbo.bill where prod_id='" + this.textBox7.Text + "';", myconn); sda1.Fill(dt); textBox8.Text = dt.Rows[1].ItemArray[1].ToString(); textBox9.Text = dt.Rows[1].ItemArray[2].ToString(); textBox10.Text = dt.Rows[1].ItemArray[3].ToString(); textBox11.Text = dt.Rows[1].ItemArray[4].ToString(); textBox12.Text = dt.Rows[1].ItemArray[5].ToString(); SqlDataAdapter sda2 = new SqlDataAdapter("select * from dbo.bill where prod_id='" + this.textBox13.Text + "';", myconn); sda2.Fill(dt); textBox14.Text = dt.Rows[2].ItemArray[1].ToString(); textBox15.Text = dt.Rows[2].ItemArray[2].ToString(); textBox16.Text = dt.Rows[2].ItemArray[3].ToString(); textBox17.Text = dt.Rows[2].ItemArray[4].ToString(); textBox18.Text = dt.Rows[2].ItemArray[5].ToString(); SqlDataAdapter sda3 = new SqlDataAdapter("select * from dbo.bill where prod_id='" + this.textBox19.Text + "';", myconn); sda3.Fill(dt); textBox20.Text = dt.Rows[3].ItemArray[1].ToString(); textBox21.Text = dt.Rows[3].ItemArray[2].ToString(); textBox22.Text = dt.Rows[3].ItemArray[3].ToString(); textBox23.Text = dt.Rows[3].ItemArray[4].ToString(); textBox24.Text = dt.Rows[3].ItemArray[5].ToString(); SqlDataAdapter sda4 = new SqlDataAdapter("select * from dbo.bill where prod_id='" + this.textBox31.Text + "';", myconn); sda4.Fill(dt); textBox32.Text = dt.Rows[4].ItemArray[1].ToString(); textBox33.Text = dt.Rows[4].ItemArray[2].ToString(); textBox34.Text = dt.Rows[4].ItemArray[3].ToString(); textBox35.Text = dt.Rows[4].ItemArray[4].ToString(); textBox36.Text = dt.Rows[4].ItemArray[5].ToString(); myconn.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)