S
Scott McNair
Hi all,
I'm having problems calling a stored procedure from within my code. If I
execute the SP manually from a Query Analyzer window it runs without a
hitch, but it seems it doesn't even fire when I try to run it from my code.
Anyway, here's both the VB code and the stored procedure:
With cmdCleanUncheckedSuites
.Connection = cnSalesWiz
.CommandType = CommandType.StoredProcedure
.CommandText = "prCleanUncheckedSuites"
.Parameters.Add("@SuiteList", SqlDbType.VarChar)
.Parameters.Add("@PresentationID", SqlDbType.Int)
.Parameters.Add("@CheckString", SqlDbType.VarChar)
.Parameters("@SuiteList").Value = Replace("'" & SQLEncode
(Request.Form("SuiteList")) & "'", vbCrLf, ",")
.Parameters("@PresentationID").Value = CInt(Request.QueryString
("ID"))
.Parameters("@CheckString").Value = Replace("'" & SQLEncode
(Request.Form("SuiteID")) & "'", vbCrLf, ",")
'These next three lines run, so I know it's making it to here
Response.Write(.Parameters("@SuiteList").Value & "<br>")
Response.Write(.Parameters("@PresentationID").Value & "<br>")
Response.Write(.Parameters("@CheckString").Value & "<br>")
.ExecuteNonQuery()
End With
CREATE PROCEDURE prCleanUncheckedSuites (
@SuiteList varchar(200),
@PresentationID varchar(50),
@CheckString varchar(8000) = ''
) AS
DELETE FROM tblItems
WHERE SuiteID IN (
SELECT SuiteID
FROM MasterSuites
WHERE SuiteNum In (
SELECT LTRIM(RTRIM(Value))
FROM Common.dbo.split
(@SuiteList,',')
) AND
SuiteID NOT IN (
SELECT LTRIM(RTRIM(Value))
FROM Common.dbo.split
(@CheckString,',')
)
) AND
PresentationID = @PresentationID
GO
I'm having problems calling a stored procedure from within my code. If I
execute the SP manually from a Query Analyzer window it runs without a
hitch, but it seems it doesn't even fire when I try to run it from my code.
Anyway, here's both the VB code and the stored procedure:
With cmdCleanUncheckedSuites
.Connection = cnSalesWiz
.CommandType = CommandType.StoredProcedure
.CommandText = "prCleanUncheckedSuites"
.Parameters.Add("@SuiteList", SqlDbType.VarChar)
.Parameters.Add("@PresentationID", SqlDbType.Int)
.Parameters.Add("@CheckString", SqlDbType.VarChar)
.Parameters("@SuiteList").Value = Replace("'" & SQLEncode
(Request.Form("SuiteList")) & "'", vbCrLf, ",")
.Parameters("@PresentationID").Value = CInt(Request.QueryString
("ID"))
.Parameters("@CheckString").Value = Replace("'" & SQLEncode
(Request.Form("SuiteID")) & "'", vbCrLf, ",")
'These next three lines run, so I know it's making it to here
Response.Write(.Parameters("@SuiteList").Value & "<br>")
Response.Write(.Parameters("@PresentationID").Value & "<br>")
Response.Write(.Parameters("@CheckString").Value & "<br>")
.ExecuteNonQuery()
End With
CREATE PROCEDURE prCleanUncheckedSuites (
@SuiteList varchar(200),
@PresentationID varchar(50),
@CheckString varchar(8000) = ''
) AS
DELETE FROM tblItems
WHERE SuiteID IN (
SELECT SuiteID
FROM MasterSuites
WHERE SuiteNum In (
SELECT LTRIM(RTRIM(Value))
FROM Common.dbo.split
(@SuiteList,',')
) AND
SuiteID NOT IN (
SELECT LTRIM(RTRIM(Value))
FROM Common.dbo.split
(@CheckString,',')
)
) AND
PresentationID = @PresentationID
GO