如何使用SqlDataReader从没有列名的数据中读取 [英] How to read from a data with no column name using SqlDataReader

查看:39
本文介绍了如何使用SqlDataReader从没有列名的数据中读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Visual Studio 2013 Ultimate 并正在创建 WPF 应用程序.

I have Visual Studio 2013 Ultimate and creating application of WPF.

我必须使用 SqlDataReader 从 SQL Server 存储过程读取数据.

I have to read the data from a SQL Server stored procedure by using SqlDataReader.

  1. 有时,如果数据存在,我可以使用 sdr(sqldatareader).Read()

但在不存在数据的情况下,我只是在存储过程中选择false",但我不知道如何通过 SqlDataReader 读取没有列名的字符串.

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.

推荐答案

您可以这样做.

reader.GetString(0); //0 stands for "the 0'th column"

这篇关于如何使用SqlDataReader从没有列名的数据中读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆