By default, neither DataReader.GetSchema() nor DataTable.PrimaryKey contains the info of the Primary Key after executing a data select command.
To retrieve Primary Key using DataReader with data, use:
SqlSelectCommand1.ExecuteReader(CommandBehavior.KeyInfo)
To retrieve Primary Key using DataReader without data, use:
SqlSelectCommand1.ExecuteReader(CommandBehavior.KeyInfo Or CommandBehavior.SchemaOnly)
To retrieve Primary Key using DataReader with data, use:
SqlDataAdapter1.MissingSchemaAction = MissingSchemaAction.AddWithKey
SqlDataAdapter1.Fill(ds)
To retrieve Primary Key using DataReader with data, use:
SqlDataAdapter1.FillSchema(ds, SchemaType.Mapped)