3
Answers

How to retrieve the database value in c# windows application

Pavithra L

Pavithra L

9y
301
1
Hai,
I want to write this retrieve query in textbox1_Textchanged event. How to do this . I just simply show the selected options in datagridview.
How can I do this, thanks for your reply....
Here is my code , Please refer this
I wrote this in textbox_Textchanged event
dataGridView1.Columns[12].DataPropertyName = "Knitting";
dataGridView1.Columns[13].DataPropertyName = "Heat_Set";
dataGridView1.Columns[14].DataPropertyName = "Dyeing";
dataGridView1.Columns[15].DataPropertyName = "Dryer";
dataGridView1.Columns[16].DataPropertyName = "Tumble";
dataGridView1.Columns[17].DataPropertyName = "Shearing";
dataGridView1.Columns[18].DataPropertyName = "Raising";
dataGridView1.Columns[19].DataPropertyName = "Stenter";
displaydata();
private void displaydata()
{
dt3 = new DataTable();
SqlDataAdapter da3= new SqlDataAdapter("selectJob_No,Customer,PO_No,O_No,Fabric,Blend,Colour,GSM,F_Width,Order_Qty,Split_Qty,Dye_Qty,Knitting,Heat_Set,Dyeing,Dryer,Tumble,Shearing,Raising,Stenter from Finishing_Production WHERE V_No='" + textBox1.Text + "' GROUP BY Job_No,Customer,PO_No,O_No,Fabric,Blend,Colour,GSM,F_Width,Order_Qty,Split_Qty,Dye_Qty,Knitting,Heat_Set,Dyeing,Dryer,Tumble,Shearing,Raising,Stenter", con1);
da3.Fill(dt3);
dataGridView1.DataSource = dt3;
}
Answers (3)