Visual Studio Dataset Designer Removing * From 2nd Query

90 Views Asked by At

I have been having this problem for years and I wonder if anyone has figured this out. When you add a table adapter to the dataset designer in Visual Studio, it generates the default query. Many times the default query will not be efficient so you can right click and add another query. But when there is a change in the underlying table structure and you reconfigure the table adapter, the 2nd query will lose the * from the sql statement. The dataset designer will change it a list of column previously present in the table.

For example, if you create a table adapter for Select * From Customers and then create another query for Select * From Customers Where Id=@Id, anytime you make a change to the Customers table and reconfigured the datatable, the second query will change to Select Id, Name From Customers.

Does anyone know how to prevent VS designer from breaking it up? I noticed that when using the DISTINCT keyword in any subsequent queries, the designer will not replace the * with column names even after adding columns from the table. Is there another keyword that can be used that stop the designer from changing any queries?

0

There are 0 best solutions below