DataTable
-
Whats the best way to get an empty Typed DataTable ? I've been using an SQL statement that returns zero rows, but the overhead of such a statement is going to get too big once the SQL table gets large.
-
Whats the best way to get an empty Typed DataTable ? I've been using an SQL statement that returns zero rows, but the overhead of such a statement is going to get too big once the SQL table gets large.
Using the SQL statement is proably the easiest way. There shouldn't be much overhead regardless of the SQL statement if no rows are returned and the WHERE clause is set if an Key column not have a value in the table. SELECT * FROM Employees WHERE EmployeeID = 0 Regardless of how many table are in the SQL statement, just make sure they are all joined correctly. After you obtain the DataTable the 1st and only time, just cache it or use a singleton. Michael
-
Using the SQL statement is proably the easiest way. There shouldn't be much overhead regardless of the SQL statement if no rows are returned and the WHERE clause is set if an Key column not have a value in the table. SELECT * FROM Employees WHERE EmployeeID = 0 Regardless of how many table are in the SQL statement, just make sure they are all joined correctly. After you obtain the DataTable the 1st and only time, just cache it or use a singleton. Michael
Here's a statement that uses less overhead since it won't require any kind of table-scan or index lookup: SELECT * FROM Employees WHERE 1=2