fill data in datagrid basing on conditin
-
Hi! i have taken one datagrid & filled data basing on the query mentioned in the OLEDBDATAADAPTER wizard from Data Tab in the Toolbox.No problem its working.Bt the problem is "i want to fill the data in datagrid basing on some condition like //where branchid="textbox1.text" // Please suggest me .... how to make query in oledbdataadapter wizard...to fill data basing on condition Neelima
-
Hi! i have taken one datagrid & filled data basing on the query mentioned in the OLEDBDATAADAPTER wizard from Data Tab in the Toolbox.No problem its working.Bt the problem is "i want to fill the data in datagrid basing on some condition like //where branchid="textbox1.text" // Please suggest me .... how to make query in oledbdataadapter wizard...to fill data basing on condition Neelima
I would go ahead and leave all the data in the DataTable. Then you can take the DataView from the DataTable and filter it. So in C# it would be: DataView dv = yourDataTable.DefaultView; dv.RowFilter = "branchid = " + textbox1.Text; vb.net dim dv as DataView = yourDataTable.DefaultView dv.RowFilter = "branchid = " + textbox1.Text Then when you set your datasource and your datagrid you set it to the dv var you have created. Then do a DataBind on the datagrid. The only other option is to pass a parameter into your command object to limit the rows coming back from the database. Hope that helps. Ben