比如我要查询 Dataset中 ID 这一列 最大值 存入 int MaxID 中怎么才能查呢?
解决方案 »
- 如何做“插件化软件”,“模块化软件”设计。
- 请简要说明一下类与结构相同点和区别?
- 请问怎样把一个数值保存到TXT文本里边去
- c# 获取硬盘序列号的方法,最好不用系统api
- 一个小问题!!!!!!!!
- 建立ASP。NET应用程序时出现错误 403 access forbidden
- 如何屏蔽掉几个热键!alt,ctrl,alt+f4,win
- 求助:我在主窗体点击按钮产生一个新的窗体,再次点击,我想让上一次的窗体显示到前边而不是再开一个窗体,怎么实现?谢谢。
- 求助:当我往FTP服务器传输文件时,可不可以监视网络流量,并实时的显示出来
- winform 下的datagrid----如何添加模版列???
- 关于dropdownlist问题
- 急问,太感激了
select (case when MAX(ID) is null then 0 else MAX(ID ) end) as 最大值 from 表名
用这个应该就可以拉不用写完整的sql语句的
请参考
DataTable table = DataSet1.Tables["Orders"]; // Presuming the DataTable has a column named Date.
string expression = "Date > '1/1/00'"; // Sort descending by column named CompanyName.
string sortOrder = "CompanyName DESC";
DataRow[] foundRows; // Use the Select method to find all rows matching the filter.
foundRows = table.Select(expression, sortOrder); // Print column 0 of each returned row.
for(int i = 0; i < foundRows.Length; i ++)
{
Console.WriteLine(foundRows[i][0]);
}
id为你的那个要查询的字段名
注意要是有多个表的话,确保使用了正确的索引