DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: passing an Ado connection to an Active-x

  1. #1
    Michael Guest

    passing an Ado connection to an Active-x


    Is there a way to pass and Ado connection to an Active-x class and have it
    recognized?
    When I try to do this, here is what happens:

    Run-Time Error '3001'

    Arguments are of the wrong type, are out of acceptable range, or are in conflict
    with one another.

    Here is a partial code:
    In Asp:
    Set Conn = Server.CreateObject("ADODB.Connection")
    conn.open "Driver=SQL Server;Server=" & sLocation&";uid=" & sUid & ";pwd="
    & sPwd & ";database=" & sDataBase

    Set objMyComponent = Server.CreateObject("mcinfo.IQS_DATE")

    nDate = objMyComponent.D2L(Conn,"06/01/00")

    In Class:
    Public Function D2L(ByRef adoConnection As Variant, dDate As Variant) As
    Variant
    Dim rsDate As ADODB.Recordset
    Dim cmdDate As ADODB.Command
    Dim prmDate As ADODB.Parameter

    Set cmdDate = New ADODB.Command

    Set cmdDate.ActiveConnection = adoConnection
    cmdDate.CommandText = "dbo.UP_CVRT_DATE_TO_LONG"
    cmdDate.CommandType = adCmdStoredProc


    Thanks in advance.

  2. #2
    Sergey Guest

    Re: passing an Ado connection to an Active-x


    Try using ByVal
    Public Function D2L(ByVal adoConnection As ADODB.Connection, dDate As Variant)
    As Variant

    Sergey

    "Michael" <craddockm@tyson.com> wrote:
    >
    >Is there a way to pass and Ado connection to an Active-x class and have

    it
    >recognized?
    >When I try to do this, here is what happens:
    >
    >Run-Time Error '3001'
    >
    >Arguments are of the wrong type, are out of acceptable range, or are in

    conflict
    >with one another.
    >
    >Here is a partial code:
    >In Asp:
    > Set Conn = Server.CreateObject("ADODB.Connection")
    > conn.open "Driver=SQL Server;Server=" & sLocation&";uid=" & sUid & ";pwd="
    >& sPwd & ";database=" & sDataBase
    >
    > Set objMyComponent = Server.CreateObject("mcinfo.IQS_DATE")
    >
    > nDate = objMyComponent.D2L(Conn,"06/01/00")
    >
    >In Class:
    >Public Function D2L(ByRef adoConnection As Variant, dDate As Variant) As
    >Variant
    > Dim rsDate As ADODB.Recordset
    > Dim cmdDate As ADODB.Command
    > Dim prmDate As ADODB.Parameter
    >
    > Set cmdDate = New ADODB.Command
    >
    > Set cmdDate.ActiveConnection = adoConnection
    > cmdDate.CommandText = "dbo.UP_CVRT_DATE_TO_LONG"
    > cmdDate.CommandType = adCmdStoredProc
    >
    >
    >Thanks in advance.



  3. #3
    Michael Guest

    Re: passing an Ado connection to an Active-x


    I tried that and it doesn't work. Same message.

    Michael

    "Sergey" <skats@newworldsys.com> wrote:
    >
    >Try using ByVal
    >Public Function D2L(ByVal adoConnection As ADODB.Connection, dDate As Variant)
    >As Variant
    >
    >Sergey
    >
    >"Michael" <craddockm@tyson.com> wrote:
    >>
    >>Is there a way to pass and Ado connection to an Active-x class and have

    >it
    >>recognized?
    >>When I try to do this, here is what happens:
    >>
    >>Run-Time Error '3001'
    >>
    >>Arguments are of the wrong type, are out of acceptable range, or are in

    >conflict
    >>with one another.
    >>
    >>Here is a partial code:
    >>In Asp:
    >> Set Conn = Server.CreateObject("ADODB.Connection")
    >> conn.open "Driver=SQL Server;Server=" & sLocation&";uid=" & sUid & ";pwd="
    >>& sPwd & ";database=" & sDataBase
    >>
    >> Set objMyComponent = Server.CreateObject("mcinfo.IQS_DATE")
    >>
    >> nDate = objMyComponent.D2L(Conn,"06/01/00")
    >>
    >>In Class:
    >>Public Function D2L(ByRef adoConnection As Variant, dDate As Variant) As
    >>Variant
    >> Dim rsDate As ADODB.Recordset
    >> Dim cmdDate As ADODB.Command
    >> Dim prmDate As ADODB.Parameter
    >>
    >> Set cmdDate = New ADODB.Command
    >>
    >> Set cmdDate.ActiveConnection = adoConnection
    >> cmdDate.CommandText = "dbo.UP_CVRT_DATE_TO_LONG"
    >> cmdDate.CommandType = adCmdStoredProc
    >>
    >>
    >>Thanks in advance.

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center