Ask a Question related to ASP Database, Design and Development.
-
spitefulgod #1
duplicate parameter values
I am running the following class to access stored procedures in my database
'///////////////////////////////////////////////////////////////////////////
///
' Class used int eh Open and Run StoredProc functions
Class DatabaseAccess
Private mdbCommand
Private mstrProcName
Public Property Get ProcName
ProcName = mstrProcName & ""
End Property
Public Property Let ProcName(ByVal strProcName)
mstrProcName = strProcName
mdbCommand.CommandText = "[" + strProcName + "]"
mdbCommand.CommandType = adCmdStoredProc
End Property
' Adds a parameter.
Public Sub AddParamter(ByVal strParamName, ByVal typVarType, ByVal
typVarOutputType, ByVal lngSize, ByVal varValue)
' Add the return Value if neccessary
If(mdbCommand.Parameters.Count <=0) Then
mdbCommand.Parameters.Append mdbCommand.CreateParameter("@RETURN_VALUE",
adInteger, adParamReturnValue)
End If
If(NOT IsNull(lngSize)) Then
mdbCommand.Parameters.Append mdbCommand.CreateParameter(strParamName,
typVarType, typVarOutputType, lngSize, varValue)
Else
mdbCommand.Parameters.Append mdbCommand.CreateParameter(strParamName,
typVarType, typVarOutputType, , varValue)
End If
'mdbCommand.Parameters(strParamName).Direction = typVarOutputType
'mdbCommand.Parameters(strParamName).Type = typVarType
'If(NOT IsNull(lngSize)) Then
' mdbCommand.Parameters(strParamName).Size = lngSize
'End If
'mdbCommand.Parameters(strParamName).Value = varValue
End Sub
' Class initilisation
Private Sub Class_Initialize()
' Set up the command object we'll be using
Set mdbCommand = Server.CreateObject("ADODB.Command")
Set mdbCommand.ActiveConnection = Application("DB_CONNECTION")
mdbCommand.CommandTimeout = 15
End Sub
Private Sub Class_Terminate()
Set mdbCommand = Nothing
End Sub
'///////////////////////////////////////////////////////////////////////////
///
' I think that's basically it, here you can execute the stored procedure
and have
' the results returned in a recordset.
Public Function OpenStoredProc(ByRef recSet, ByRef varReturn)
Dim varVarient
Dim lngRecords
OpenStoredProc = -1
'mdbCommand.Prepared = True
' Open the recordset
Set recSet = mdbCommand.Execute (lngRecords)
' Record the return values
varReturn = mdbCommand.Parameters("@RETURN_VALUE").Value
OpenStoredProc = 1
End Function
'///////////////////////////////////////////////////////////////////////////
///
' Same as above but just runs, no recordset
Public Function RunStoredProc(ByRef varReturn)
Dim varVarient
Dim lngRecords
RunStoredProc = -1
mdbCommand.Prepared = True
' Execute the main command
mdbCommand.Execute
' Record the return values
varReturn = mdbCommand.Parameters("@RETURN_VALUE").Value
RunStoredProc = 1
End Function
End Class
and on the ASP Page
<!--#include virtual="Scripts/accessclass.asp"-->
Set clsDatabase = New DatabaseAccess
clsDatabase.ProcName = "usp_SavePictureInfo"
clsDatabase.AddParamter "@ID", adGUID, adParamInputOutput, Null, Null
clsDatabase.AddParamter "@Name", advarchar, adParamInput, 50,
fcnTrimToNull(strPicName)
clsDatabase.AddParamter "@Comments", advarChar, adParamInput, 100,
"tester" 'fcnTrimToNull(strComments)
clsDatabase.AddParamter "@Credit", advarChar, adParamInput, 100,
fcnTrimToNull(strCredit)
clsDatabase.AddParamter "@FileName", advarChar, adParamInput, 255,
fcnTrimToNull(strPrevFile)
clsDatabase.AddParamter "@FileSize", adBigInt, adParamInput, Null, 0
clsDatabase.RunStoredProc lngReturn
The problem I am having is that the parameters seem to be duplicating before
I send them into the execute function so that my parameter list contains
@RETURN_VALUE,@ID,@Name,@Comments,@Credit,@FileNam e,@FileSize,@ID,@Name,@Com
ments,@Credit,@FileName,@FileSize
I'm really not sure why this is occuring and I'm wondering if anyone has any
insight into the problem, thanks in advance.
spitefulgod Guest
-
#40143 [Opn->Bgs]: how to get parameter values of stored procedure.?
ID: 40143 Updated by: tony2001@php.net Reported By: hd4_all at yahoo dot co dot in -Status: Open +Status: ... -
#40143 [NEW]: how to get parameter values of stored procedure.?
From: hd4_all at yahoo dot co dot in Operating system: windows 2000 prof. PHP version: 5.2.0 PHP Bug Type: MySQLi related... -
Get input parameter values
Hi Is there any way to get the values of input parameter of current executing web method programmatically? I just want to put the input parameters... -
duplicate values in the index, primary key, or relationship
I have a MSA2K db. Table: customers Columns: fileNumber: (primary) Indexed(No Duplicates) fileName Client ClientType fileYear boxNumber:... -
Retrieving Hyperlink parameter values in PHP
I have a PHP program that creates a page with several links all to the same URL but with different parameter values in the hyperlink e.g. <a...



Reply With Quote

