问题描述
- 求大神帮我把这段代码注释下,看不懂啊
-
SqlParameter[] arParms = new SqlParameter[2]; arParms[0] = new SqlParameter(""@userid"" enamestr); arParms[0].Direction = ParameterDirection.Input; arParms[2] = new SqlParameter(""@right"" SqlDbType.VarChar 1); arParms[2].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery ( connectionString CommandType.StoredProcedurep_uis_save"" arParms ); string oknot = Convert.ToString(arParms[2].Value); //执行存储过程返回返回数据表 DataSet userds = SqlHelper.ExecuteDataset ( connectionString CommandType.StoredProcedurep_sys_djget"" arParms ); System.Data.DataTable table = userds.Tables[0]; System.Data.DataView view = new System.Data.DataView(table); if (view.Count > 0) { } }
解决方案
SqlParameter[] arParms = new SqlParameter[2];
arParms[0] = new SqlParameter(""@userid"" enamestr);
arParms[0].Direction = ParameterDirection.Input;//输入参数
arParms[2] = new SqlParameter(""@right"" SqlDbType.VarChar 1);
arParms[2].Direction = ParameterDirection.Output;//输出参数
SqlHelper.ExecuteNonQuery
(
connectionString//数据库连接
CommandType.StoredProcedure//类型
p_uis_save""//存储过程名称
arParms //存储过程参数
);
string oknot = Convert.ToString(arParms[2].Value);//结果
//执行存储过程返回返回数据表 DataSet userds = SqlHelper.ExecuteDataset ( connectionString CommandType.StoredProcedurep_sys_djget"" arParms ); System.Data.DataTable table = userds.Tables[0]; System.Data.DataView view = new System.Data.DataView(table);//看下面view.count ,view 应该是结果集 if (view.Count > 0) { }}
其他的不懂,看代码只是知道这么多。
解决方案二:
怀疑第四/五行数组溢出 arParms[2] = new SqlParameter(""@right"" SqlDbType.VarChar 1);
arParms[2].Direction = ParameterDirection.Output;
时间: 2024-09-14 00:09:07