Solved

ASP,SQL Server

Posted on 2001-08-01
4
1,015 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
  • 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 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

831 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