Conversion failed when converting from a character string to uniqueidentifier. in C# code when I try to insert record by SQL insert statement -
i have method in c# code insert record in sql table , getting error right when execute insert query:
"conversion failed when converting character string uniqueidentifier."
this line have in c# code produce error agencyid , user both uniqueidentifier in sql table.
db.addinparameter(command, agency, dbtype.string, dto.agencyid); db.addinparameter(command, user, dbtype.string, dto.user); this insert stored proc:
alter procedure [dbo].[insert_applicantloan] @remref varchar(15) = null ,@agency varchar(100) = null /* uniqueidentifier */ ,@user varchar(100) = null /* uniqueidentifier */ begin insert [dbo].[applicantloan] ( [remref] ,[_agency] ,[_user] ) values ( @remref ,@agency ,@user) set @id = scope_identity() select @id end end
well, not sure if misread something, looks data type in db supposed uniqueidentifier. means you'll have update sp accept parameters of type, instead of varchar, now.
Comments
Post a Comment