我有一个这样的存储过程:
ALTER PROCEDURE [dbo].[usp_CSR_UpdateDailyCustomerWithLCDHistory]
-- Add the parameters for the stored procedure here
@person_id numeric(18, 0),
@last_contact_date datetime,
@source nvarchar(50),
@callLogId int,
@createdBy nvarchar(50)
AS
BEGIN...END
在我的代码中,我将此存储过程称为:
public void UpdateDailyCustomerWithLCDHistory(string callerId,
int callLogId, string csrName)
{
try
{
Database db = DatabaseFactory.CreateDatabase
("MarketingWriteConnectionString");
DbCommand dbCommand =
db.GetStoredProcCommand("usp_CSR_UpdateDailyCustomerWithLCDHistory");
dbCommand.CommandTimeout = AppSetting.Instance.GetCommandTimeout();
db.AddInParameter(dbCommand, "person_id", DbType.Decimal, callerId);
db.AddInParameter(dbCommand, "last_contact_date", DbType.Date,
DateTime.Now.ToShortDateString());
db.AddInParameter(dbCommand, "source", DbType.String, "CSR");
db.AddInParameter(dbCommand, "callLogId", DbType.Int32, callLogId);
db.AddInParameter(dbCommand, "createdBy", DbType.String, csrName);
db.ExecuteNonQuery(dbCommand);
}
}
这是我的表结构:
CREATE TABLE [dbo].[tblDailyCustomerLastContactDateHistory](
[person_id] [numeric](18, 0) NOT NULL,
[source] [nvarchar](50) NOT NULL,
[callLogId] [int] NULL,
[createdBy] [nvarchar](50) NULL,
[last_contact_date] [datetime] NOT NULL,
部署应用程序后,出现错误
无法将参数值从字符串转换为小数
很多时候,虽然不是一直。谁能告诉我可能出了什么问题?