>>ExecuteReader doesn't get all the records (it doesn't even get the first until you tell it to Read().
>>It is a way to get the schema but you could as well query schema catalogs for it.
>
>I'm sorry to say the opposite but this this is not technically true. Before, I had:
>
>
>lcSQL = "Select * From " + tcTable + " Where 1=2"
>oCommand.CommandText = lcSQL
>oDataReader = oCommand.ExecuteReader()
>oDataTable = oDataReader.GetSchemaTable
>
>
>As, I wanted to make sure that I would have a minimum SQL command to be executed returning no record in order to get an immediate result. Then, you mentioned that ExecuteReader() does not pull any record. So, I changed to this:
>
>
>lcSQL = "Select * From " + tcTable
>oCommand.CommandText = lcSQL
>oDataReader = oCommand.ExecuteReader()
>oDataTable = oDataReader.GetSchemaTable
>
>
>As soon as I did this on a 500000 records table, this brought the application down. A SQL query is in fact executed for all the records. I had to put back the condition.
Michel,
You're right on that, however if you include CommandBehavior.SchemaOnly then query is not executed.
Cetin