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 > stored Procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-21-04, 08:05
nnmmss nnmmss is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
Question stored Procedure

I am using asp with sql database
This is my stored procedure


set myconn=server.CreateObject("ADODB.connection")
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = myconn
cmd.CommandText = "Min_ProgId"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("RecDate",adchar,adParamInput)
cmd("RecDate") = ObjDate
set rst=cmd.Execute
Response.Write(rst("ProgId"))

and this is my Stored Prcedure


CREATE PROCEDURE dbo.Min_ProgId @RecDate char(15) AS
select ProgId from TblTotal Where convert(smalldatetime,Fromtime ,14)=(select Min(convert(smalldatetime,Fromtime ,114)) as Min_Fld from TblTotal Where ObjDate=@RecDate)


I need to pass the parameter ro stored procedure. but i get this error
"Error Type:
ADODB.Parameters (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete information was provided."

The way i am calling stored procedure is what the microsoft has told. and also if i execute the stored procedure without passign a parameter to it , it works fine. but i need to pass a parameter RecDate to it, where is the problem, please help me?
Thank you

Last edited by nnmmss; 02-21-04 at 08:14.
Reply With Quote
  #2 (permalink)  
Old 02-22-04, 15:15
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Set myconn=Server.CreateObject("ADODB.connection")
myconn.ConnectionString = ? /* ? is a connection string */
myconn.Open
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = myconn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "Min_ProgId"
cmd.Parameters.Append
cmd.CreateParameter("RecDate",adchar,adParamInput, 15, ObjDate)
cmd.Parameters.Append
cmd.CreateParameter("ProgId",adInteger,adParamOutp ut)
Set rst = cmd.Execute
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