Click here to Skip to main content
15,885,956 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
C#
dao.ExecCommand(dao.CreateCommand(DBProcedures.WorkOrder.USP_UPDATE_BUSINESS_EMAILADDRESS,
                  new CSqlDbParameterCollection
                   {
                       {"BusinessId",business.BusinessID},
                       {"EmailAddress",business.EmailAddress},
                       {"ModifiedBy",business.WorkOrderDetails.FilerID},
                       {"ModifiedDate",DateTime.Now},
                       {"CreatedBy",business.WorkOrderDetails.FilerID},
                       {"CreatedDate",DateTime.Now}

                   }));



and procedure is

SQL
Create Procedure [CORP].[USP_UPDATE_BUSINESS_EMAILADDRESS]
@BusinessId int= null,
@EmailAddress varchar(50)= null
As
Begin
Update Corp.Business set EmailAddress = @EmailAddress Where BusinessId = @BusinessId
End
Posted

1 solution

Um.
Look at your code?
Your SP definition has two parameters:
SQL
@BusinessId int= null,
@EmailAddress varchar(50)= null
But you are trying to pass it six:
C#
{"BusinessId",business.BusinessID},
{"EmailAddress",business.EmailAddress},
{"ModifiedBy",business.WorkOrderDetails.FilerID},
{"ModifiedDate",DateTime.Now},
{"CreatedBy",business.WorkOrderDetails.FilerID},
{"CreatedDate",DateTime.Now}

I suspect you are calling the wrong SP...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900