问题
I have Visual Studio 2013 Ultimate and creating application of WPF.
I have to read the data from a SQL Server stored procedure by using SqlDataReader
.
Sometimes, if data exists, I can read data using
sdr(sqldatareader).Read()
But in the case when no data exists, I just select 'false' in stored procedure but I don't know how to read that string with having no column name by
SqlDataReader
.
回答1:
You can do this.
reader.GetString(0); //0 stands for "the 0'th column"
来源:https://stackoverflow.com/questions/35356236/how-to-read-from-a-data-with-no-column-name-using-sqldatareader