c#调用存储过程的问题

hya0114145 hya0114145 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

public static int ChiDao(string name, DateTime mintime,DateTime maxtime)
{
try
{
SqlParameter[] par = new SqlParameter[]
{
new SqlParameter("@name",SqlDbType.VarChar).Value=name,
new SqlParameter("@datemin",SqlDbType.DateTime).Value=mintime,
new SqlParameter("@datemax",SqlDbType.DateTime).Value=maxtime,
new SqlParameter("@shuchu",SqlDbType.Int).Direction=ParameterDirection.Output
};
DBHelper.ExecuteCommand("chaxunchidao",par);


}
catch (Exception)
{

throw;
}


public static void ExecuteCommand(string name, SqlParameter[] paramArray)
{
using (conn = new SqlConnection(SqlConn))
{
try
{
command = new SqlCommand();
command.CommandText = name;
command.Connection = conn;
command.CommandType = CommandType.StoredProcedure;
for (int i = 0; i < paramArray.Length; i++)
{
command.Parameters.Add(paramArray[i]);
}
conn.Open();
command.ExecuteNonQuery();
}
catch (Exception e)
{
throw e;
}
}

}

在ChiDao中怎样返回@shuchu的值




...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
hya0114145
C# 111,129 成员 642,540 内容