How to Check for Column Name in SqlDataReader object in C# ?
Answers
Answered by
0
want to check if a column exists in the datareader before attempting to read it ...
Answered by
2
hi there✋✋✋
select top 0 s.* into _TempTableForColumns from (<your query here>) s;
Then use information_schema (or the system tables if you prefer):
select * from information_schema.columns where table_name = '_TempTableForColumns' and schema_name = 'dbo';
drop table _TempTableForColumns;
Thanks❤♥
select top 0 s.* into _TempTableForColumns from (<your query here>) s;
Then use information_schema (or the system tables if you prefer):
select * from information_schema.columns where table_name = '_TempTableForColumns' and schema_name = 'dbo';
drop table _TempTableForColumns;
Thanks❤♥
Similar questions