?
Solved

ASP,SQL Server

Posted on 2001-08-01
4
Medium Priority
?
1,019 Views
Last Modified: 2007-11-27
Thanks in advance!

I have enclosed my code:

I'm receiving the following error:
     Error Type:
ADODB.Parameters (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete information was provided.
/test/report3.asp, line 157


Line 157 is :      cmd.CommandType =4    


     Set cn = Server.CreateObject("ADODB.Connection")
                                         cn.Open Application("DB")
                                        Set cmd = Server.CreateObject("ADODB.Command")
                                        Set cmd.ActiveConnection = cn
                                        cmd.CommandText = "TrafficReport2"                                        
                                        cmd.CommandType =4    
                                        cmd.Parameters.Append cmd.CreateParameter ("RetVal",  adLongVarChar,adParamReturnValue)
                                        cmd.Parameters.Append cmd.CreateParameter("Param1", adLongVarChar, adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param2", adLongVarChar, adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param3", adLongVarChar, adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param4", adLongVarChar, adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param5", adLongVarChar, adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param6", adInteger , adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param7", adLongVarChar, adParamInput)
                                        cmd.Parameters.Append cmd.CreateParameter("Param8", adLongVarChar, adParamInput)
                               
                                        ' Set value of Param1 of the default collection to 22
                                        cmd("Param1") =  strGroupBy
                                        cmd("Param2") = dtStart
                                        cmd("Param3") = dtEnd
                                        cmd("Param4") = iMarketer
                                        cmd("Param5") =  iSubMarketer
                                        cmd("Param6") = ioffer_id
                                        cmd("Param7") =  strUse
                                        cmd("Param8") =  strGrouping
                                                                           
                                         cmd.Execute   %>
                                        Calling via method 2<BR>
                                        ReturnValue = <% Response.Write cmd(0) %><P><%
0
Comment
Question by:TEALTEAL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 6

Expert Comment

by:acampoma
ID: 6342185
try this syntax:

    .Parameters.Append( .CreateParameter("BeginId", adVarChar, adParamInput, Len(BeginId), BeginId))
    .Parameters.Append( .CreateParameter("EndId", adVarChar, adParamInput, Len(EndId), EndId))
    .Parameters.Append( .CreateParameter("TableName", adVarChar, adParamInput, Len(TableName), TableName))
0
 
LVL 6

Expert Comment

by:acampoma
ID: 6342189
looks like maybe you forgot some parenthesis
0
 
LVL 2

Expert Comment

by:vspeter
ID: 6342829
I think you've got the wrong driver. I've experienced the same problem when trying to call a stored procedure using ADO object with a DIFFERENT software that's compatible with COM object.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 150 total points
ID: 6343436
It would be good to see the header of the stored procedure too, but i guess that acampoma's idea goes into the right direction:

the Returnvalue can only be adInteger:
cmd.Parameters.Append cmd.CreateParameter ("RetVal",  adInteger,adParamReturnValue)

char/varchar/... must be defined with their length, integer datatypes not:
cmd.Parameters.Append cmd.CreateParameter("Param1", adVarChar, adParamInput, 100)

seeing the prefixes of your variables for the values, i guess that not all the parameters are LongVarchar, but dates and integers...

In order to define the correct values, you might do this:

cmd.CommandText  "TrafficReport2"                          
cmd.CommandType =4    
cmd.Parameters.Refresh
and then analyse the .Parameters.Collection. This will help you to find the correct values for your code. I recommend not to use the .Refresh in production code because of performance, but for the development it is good trick.

Cheers

                                       



Cheers

0

Featured Post

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question