Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting all records just for the schema
Message
From
09/04/2007 06:06:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
08/04/2007 12:33:33
General information
Forum:
ASP.NET
Category:
Databases
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01213027
Message ID:
01213367
Views:
7
>>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform