Science, asked by saranyapk144, 1 year ago

How to Check for Column Name in SqlDataReader object in C# ?

Answers

Answered by rockyak4745
0
want to check if a column exists in the datareader before attempting to read it ...
Answered by Anonymous
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❤♥
Similar questions