How to read from a data with no column name using SqlDataReader

左心房为你撑大大i 提交于 2019-12-10 11:55:08

问题


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.

  1. Sometimes, if data exists, I can read data using sdr(sqldatareader).Read()

  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!