Solved

ASP,SQL Server

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ssms - object execution statistics 12 37
how to fix this error 14 46
SQL JOIN 6 31
SQL Date Retrival 7 26
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.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now