0

GetSchemaTable() always returns IsAliased as null, and BaseColumnName is always the same as ColumnName, even though I have used an alias name to fetch column data from Stored Procedure.

SP:

SELECT u.Name AS [Display Name]  
  ,code AS [Display Code]
........

C#:

DbDataReader reader = null;
DataTable dt = reader.GetSchemaTable();
Thom A
  • 88,727
  • 11
  • 45
  • 75
user5663970
  • 119
  • 2
  • 13
  • 1
    If you're using a Stored Procedure, then whatever is calling that Procedure will have no idea what underlying objects, and their aliases, are used within that Procedure. – Thom A Oct 16 '20 at 10:42
  • Get Schema is not looking at the stored procedure. Get Schema is just looking at the databases, tables, and columns in the server. – jdweng Oct 16 '20 at 10:51
  • Update- was able to solve the issue by adding commandBehavior. – user5663970 Oct 17 '20 at 11:37

1 Answers1

0

Was able to solve the issue by adding commandBehavior

user5663970
  • 119
  • 2
  • 13