求助关于SetParameter的问题!
/// <summary>/// 为Command变量设置参数
/// </summary>
/// <param name="DBName">名称</param>
/// <param name="DBValue">值</param>
/// <param name="dbtype">类型</param>
public void SetParameter(string DBName,object DBValue,SqlDbType dbtype)
{
try
{
if (dbtype == SqlDbType.UniqueIdentifier)
{
this.m_Cmd.Parameters.Add(new SqlParameter(DBName,dbtype));
this.m_Cmd.Parameters[DBName].Value = new Guid(DBValue.ToString());
}
else
{
this.m_Cmd.Parameters.Add(new SqlParameter(DBName,dbtype));
this.m_Cmd.Parameters[DBName].Value = DBValue;
}
}
catch (Exception err)
{
ErrLog.WriteErrLog("设置参数不成功:参数名称=" + DBName + ";参数值=" + DBValue.ToString() + "错误信息=" + err.Message);
}
}
cmmgr.SetParameter("@Number5", number.T_Number5, SqlDbType.Int); //此句调用上面的
我调试了发现this.m_Cmd.Parameters[DBName].Value的值是正确的,但是我的数据库中Number5的值老是更新不了。有没有高手能帮我解答一下!谢谢