If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Invalid character value for cast specification in running SQL Stored Proc from ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-03, 13:31
msaunders msaunders is offline
Registered User
 
Join Date: Jan 2003
Posts: 2
Angry Invalid character value for cast specification in running SQL Stored Proc from ASP

Hi,

I am trying to run a stored procedure from an asp page.

I've confirmed the following query line in Enterprise Manager (SQL2000)

usp_searchAdv @startdate='17/12/2002 0:0:0', @enddate='17/1/2003 23:59:59', @uid='', @id=0, @rep=0, @category=0, @categoryNOT='', @department=0, @status='-1', @priority=0, @defectType='', @freetextTitle='remove', @freetextDesc='remove', @iOrder=1

which returns a valid record set.

I'm trying to run this from the ASP page with the code ....

<%
Set oUSPconn = Server.CreateObject("ADODB.Connection")
oUSPconn.Open "DSN=validDSN;uid=validUser;pwd=validPassword"

Set oUSPcmd = Server.CreateObject("ADODB.Command")
Set oUSPcmd.ActiveConnection = oUSPconn

oUSPcmd.CommandText = strUSPcommandText 'value shown below

oUSPcmd.CommandType = 1 'adCmdText
oUSPcmd(0).Direction = 4 'adParamReturnValue


'create the RS from running the usp
Set rstProbList = Server.CreateObject("ADODB.Recordset")
oUSPconn.CursorLocation = 3 'adUseClient (2=adUseServer)
Set rstProbList = oUSPcmd.Execute
%>

the value of strUSPcommandText is...
{? = CALL usp_searchAdv (@startdate='17/12/2002 0:0:0', @enddate='17/1/2003 23:59:59', @uid='', @id=0, @rep=0, @category=0, @categoryNOT='', @department=0, @status='-1', @priority=0, @defectType='', @freetextTitle='remove', @freetextDesc='remove', @iOrder=1)}

and the error is a strange....

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification

E:\DEFECTLOGGING\LIBERUM\WWW\REP\..\runUSP_return. txt, line 21

------
where line 21 is the
Set rstProbList = oUSPcmd.Execute
command

Any ideas or suggestions would be greatfully received.

Mark
Reply With Quote
  #2 (permalink)  
Old 01-17-03, 13:40
msaunders msaunders is offline
Registered User
 
Join Date: Jan 2003
Posts: 2
SOLVED

removed all the complex code there and replaced the query with

EXECUTE usp_searchAdv @startdate='17/12/2002 0:0:0', @enddate='17/1/2003 23:59:59', @uid='', @id=0, @rep=0, @category=0, @categoryNOT='', @department=0, @status='-1', @priority=0, @defectType='', @freetextTitle='remove', @freetextDesc='remove', @iOrder=1

called it using a simple

Dim rstProbList, start, oUSPconn

set oUSPconn = server.createobject("adodb.connection")
oUSPconn.Open cnnDB
set rstProbList = oUSPconn.Execute(strUSPcommandText)



duh!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On