Home All Groups Group Topic Archive Search About

DataReader's GetSchemaTable Method not fully working

Author
17 Apr 2006 1:44 PM
Jaffa
Hi,

So I have this:

SqlDataReader rdr = ExecuteDataReader(connection, Command.Text, "Select *
from myTableName");

DataTable table = rdr.GetSchemaTable();

This is working great and telling me all the defined columns within the
myTableName, except if the column is an identity and autoincremented it is
not returning the right AutoIncrementSeed or AutoIncrementStep. Am I doing
something wrong or does GetSchemaTable() not return the AutoIncrementStep.

Or is there another way to find out what the field/column's
AutoIncrementStep, AutoIncrementSeed  is?

Thanks,
Matt

Author
17 Apr 2006 2:25 PM
Robert Simpson
Are you specifying CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly when
you opened the reader?

Robert

Show quote
"Jaffa" <Ja***@discussions.microsoft.com> wrote in message
news:D2CDD3F3-98B0-4012-88BE-DD3273DEDC04@microsoft.com...
> Hi,
>
> So I have this:
>
> SqlDataReader rdr = ExecuteDataReader(connection, Command.Text, "Select *
> from myTableName");
>
> DataTable table = rdr.GetSchemaTable();
>
> This is working great and telling me all the defined columns within the
> myTableName, except if the column is an identity and autoincremented it is
> not returning the right AutoIncrementSeed or AutoIncrementStep. Am I doing
> something wrong or does GetSchemaTable() not return the AutoIncrementStep.
>
> Or is there another way to find out what the field/column's
> AutoIncrementStep, AutoIncrementSeed  is?
>
> Thanks,
> Matt
Author
17 Apr 2006 2:33 PM
Jaffa
I have not specified both of those together I have done each individually to
get the information out. So do both need to be specified to get it to work?

Thanks,
Matt

AddThis Social Bookmark Button