Discussion:
My cfstoredproc is there but nothing happen on the db
(too old to reply)
alecken
2009-03-12 17:00:03 UTC
Permalink
I created a temp. error log, what I did, I wrote a detele statement to clear up
all the old error records in the begining and after that, I'm inserting new
error(s) if they become available.
I use stored procedure and the reason for doing this is just to practise with
<cfstoredproc tag.
The funny thing is, I can see the stored proc was run from the debug view but
the record did not get deleted? Have I done something wrong with the code? no
error on the screen.
I use CF8, DB Sybase & windows

<!--- start with a clean up older error records --->
<cfstoredproc procedure="sp_deletedOldError" datasource="#mydb#">
<cfprocparam cfsqltype="CF_SQL_VARCHAR" dbvarname="@user1"
value="#Trim(session.user)#">
<cfprocparam cfsqltype="CF_SQL_VARCHAR" dbvarname="@user2" value="">

</cfstoredproc>

Here is my simple procedures:
CREATE PROCEDURE dbo.sp_deletedOldError

@user1 varchar (2),
@user2 varchar (2)

AS
BEGIN
Delete from tbl_error
Where users IN ('@user1','@user2')
END
cfwild
2009-03-21 03:06:12 UTC
Permalink
Two things I see, may/may not be an issue.

1). on your varchar (2), is this enough to pass your SESSION.user information?

2). I'm not seeing a "value" in your second cfprocparam statement. You're
showing value = "". Should this be #SESSION.....something#

cfwild
alecken
2009-03-24 17:45:50 UTC
Permalink
The session.user information only cosist of 2 letter, ex.BA or TT and the other value is an empty value or empty string.
I want to delete any record, if with no user session, exist
JR "Bob" Dobbs
2009-03-24 20:40:39 UTC
Permalink
A couple of items:

1. In your stored proc create script you need to remove the single quotes in:
Where users IN ('@user1','@user2') .
Your database server is treating @user1 and @user2 as literals rather then
variables since they are quoted strings.

2. I'm not sure about Sybase, but I suspect that the prefix "sp_" is reserved
for system stored procedures and should not be used when you create your own
stored procedures.

3. In your CF code note that the dbvarname attribute is obsolete. Parameters
should be specified in the order they are defined in your procedure.
Loading...