Copy link to clipboard
Copied
I am getting the error when I add a parameter to a Cold Fusion program and a stored procedure. If I take the comments out, I get error.
What am I doing wrong?
This is the ColdFusion part.
<cfset service='test'>
<cfset units=12.34>
<cfset date1='12/25/08'>
<cfset recid=100>
<cfstoredproc procedure="try2" datasource="#dso#">
<!--- <cfprocparam cfsqltype="cf_sql_char" value="#served#"> --->
<cfprocparam cfsqltype="cf_sql_float" value="#units#">
<cfprocparam cfsqltype="cf_sql_datetime" value="#date1#">
<cfprocparam cfsqltype="cf_sql_numeric" value="#recid#">
<cfprocparam cfsqltype="cf_sql_numeric" type="out" variable="recs">
</cfstoredproc>
This is the sql server part.
set
ANSI_NULLS ON
set
QUOTED_IDENTIFIER ON
GO
ALTER
PROCEDURE [dbo].[try2]
(
-- @Arg_served char,
@Arg_units
decimal(6,2),
@Arg_date1
datetime,
@Arg_recid
numeric,
@Arg_id2
int out
)
AS
BEGIN
SET NOCOUNT ON;update table1 set units=@arg_units, date1=@arg_date1 where recid=@arg_recid;select @Arg_id2=@@rowcount;END
Copy link to clipboard
Copied
The first thing that jumps out is that the CF variable is called "service" and the cfprocparam is called "served". But I think the real issue is @arg_served char is one character in length so you need to add a length such as @arg_served char(10) to pass in a value of "test".