如题,我的sql语句可写成"select count(*) as RecNum from mytable where age = 30"
或"select count(*) from mytable where age = 30",现在不知道该如何把结果赋给变量int n;
请教!!!!!!!!!!1我已经试了好几个方法都不行,请指教!!!!!!!!!!
或"select count(*) from mytable where age = 30",现在不知道该如何把结果赋给变量int n;
请教!!!!!!!!!!1我已经试了好几个方法都不行,请指教!!!!!!!!!!
解决方案 »
- oracle 8.0.5下的存储过程出现错误
- 两个大表的关联查询问题-如何提高效率
- commit提交问题
- 我们要实现一个统计功能,这个SQL语句不知道怎么写啊(在线等待)
- 大哥救我!!!
- ORACLE中的主机字符串真讨厌, 不知道干什么用的!
- send one complex porblem on 'sql ' to our friends ,come here plese,baby,baby!!
- 请教高手:是否在创建视图中select语句中不能有order by 子语句?
- csdn怎么搞的,总是回复不上,我都想骂人了!!
- navicat 64位 for oracle问题
- oracle版本兼容性問題
- ORACLE 连接多个数据库问题
通过C#调用,返回一个DataSet,然后把DataSet中第一行第一列数据取出来就好了.
DataSet ds=......
int n=Convert.ToInteger(ds.Table[0].Row[0][0]);
代码大概是这样.
{
SqlCommand myCommand = new SqlCommand(myScalarQuery, myConnection);
myCommand.Connection.Open();
int n=Convert.toint32( myCommand.ExecuteScalar().toString());
myConnection.Close();
}
n就是你要的
上面应该是OracleCommand,
int n=Convert.toint32( myCommand.ExecuteOracleScalar().toString());