Solved

ASP,SQL Server

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

730 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