3
Answers

Problem in dynamic sql - Table Adapters C# 2008

faraz akram

faraz akram

15y
3.5k
1
hi , i have developed a search screen that takes dynamic "where" clause in sql select on runtime depend upon user input. the code is mentioned below.... -------------------------------------------------- OdbcConnection odbc_conn = new OdbcConnection("connection string"); OdbcDataAdapter odbc_da = new OdbcDataAdapter("select * from my_table" + whereclause, odbc_conn); odbc_da.FillSchema(dataSet1, System.Data.SchemaType.Source, "my_table"); odbc_da.Fill(dataSet1, "my_table"); my_table.BindingSource.DataSource = dataSet1.Tables["my_table"]; -------------------------------------------------- "Fill" is the query that i created in the dataset1 designer the normal through wizard in the my_tabletableadapter. Now first time it works fine and selecting the data on basic of parameters in "WHERECLAUSE" but second time it does not override the previous sql with a new sql , where clause is changing prperly on user input but the time when it comes on this line of code odbc_da.FillSchema(dataSet1, System.Data.SchemaType.Source, "my_table"); it shows the previous dataset , any help regards fazy sam
Answers (3)