如何纯粹从执行select命令的结果中提取一些值? [英] How to extract some value in the result of executing the select command purely?

查看:99
本文介绍了如何纯粹从执行select命令的结果中提取一些值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不使用dbdatareader的情况下,能否给我一个解决方案,以从执行select命令的结果中提取一些值,例如:

Without using dbdatareader, could you please give me a solution to extract some value in the result from executing a select command, for example:

mysqlcommand.CommandText = "Select max(Mark) from MarkSummary";
mysqlcommand.ExecuteNonQuery()


我想在这里提取的值是我所说的Mark列的最大值,而无需使用SqlDataReader或IDataReader甚至在从中提取数据甚至创建存储功能之前,都无需将数据加载到DataTable中.我想用Select命令来原始地和纯粹地处理它.
非常感谢!


The value I want to extract here is max of the column Mark as I said without using SqlDataReader or IDataReader or even loading the data into a DataTable before extracting from that or even creating a stored function. I want to deal it primitively and purely with Select command.
Thank you so much!

推荐答案

使用ExecuteScalar()例如
object max = mysqlcommand.ExecuteScalar()


这篇关于如何纯粹从执行select命令的结果中提取一些值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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