执行存储过程的问题
现有一存储过程代码如下:
CREATE PROCEDURE Bbs_UpdateAnswerNum
(
@TitleID int
)
AS
UPDATE
BBSTitle
SET
AnswerNum = AnswerNum + 1
WHERE
TitleID = @TitleID
GO
App_Code/AddNumDate.cs代码:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using SQLHelper;
using System.Data.SqlClient;
/// <summary>
/// AddNumDate 的摘要说明
/// </summary>
namespace WebAddNumDate
{
public class AddNumDate
{
public AddNumDate()
{
}
public void UpdateAnswerNum(int nTitleID)
{
///定义类SQLHelper
SQLHelper.SQLHelper sqlHelper = new SQLHelper.SQLHelper();
///创建访问数据库的参数
SqlParameter[] paramList = {
sqlHelper.CreateInParam( "@TitleID ", SqlDbType.Int, 4,nTitleID)
};
try
{
///执行存储过程
sqlHelper.RunProc( "Bbs_UpdateAnswerNum ", paramList);
}
catch (Exception ex)
{
///抛出执行数据库异常
SystemError.CreateErrorLog(ex.Message);