retreive array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Srinivasa Reddy K Ganji

    #1

    retreive array

    I have a function written in vb 6 which returns an array of results within a
    collection.
    In asp i get the array with this type of code

    arList = objGetRecords(" cdrecords")

    I generated wsdl file for this function using soap toolkit and the dll. Then
    added web reference to asp.net(c#) project and instantiated the function.
    How do I retrieve the array of results here in c#? Any idea? Sample code
    would be nice.

    Thanks,

    Reddy


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: retreive array

    Srinivasa,

    If you could post the code for the objGetRecords method, then that would
    help. Most likely, it is returning an object, or an array cast to an
    object. Are the types all simple types?


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nicholas.paldin o@exisconsultin g.com

    "Srinivasa Reddy K Ganji" <gksreddy@adsgr oup.com> wrote in message
    news:u0JoUbcVDH A.3924@tk2msftn gp13.phx.gbl...[color=blue]
    > I have a function written in vb 6 which returns an array of results within[/color]
    a[color=blue]
    > collection.
    > In asp i get the array with this type of code
    >
    > arList = objGetRecords(" cdrecords")
    >
    > I generated wsdl file for this function using soap toolkit and the dll.[/color]
    Then[color=blue]
    > added web reference to asp.net(c#) project and instantiated the function.
    > How do I retrieve the array of results here in c#? Any idea? Sample code
    > would be nice.
    >
    > Thanks,
    >
    > Reddy
    >
    >[/color]


    Comment

    • Srinivasa Reddy K Ganji

      #3
      Re: retreive array

      Hi Nicholas,

      This was the function in the VB active x dll project

      Public Function GetCDRecords() As Variant

      Dim colResponse As New Collection
      Dim arList As Variant

      On Error GoTo GetCDRecordsErr Handler

      Set objDB = New ADODB.Connectio n
      Set objRs = New ADODB.Recordset
      objDB.Open strConn

      strSql = "select cdm.cdno, cdm.cdtitle, cdcategory = (select cdcatname from
      cdcategories cdc where cdc.cdid = cdm.cdid) from cdmaster cdm where
      cdm.Status = 1 order by 1 desc"
      objRs.Open strSql, strConn, adOpenKeyset, adLockReadOnly
      If Not (objRs.BOF And objRs.EOF) Then
      arList = objRs.GetRows()
      End If
      objRs.Close

      colResponse.Add arList, "CDRecords"
      colResponse.Add False, Key:="error"
      Set GetCDRecords = colResponse

      Set objRs = Nothing
      objDB.Close
      Set objDB = Nothing
      Exit Function

      GetCDRecordsErr Handler:
      Set objRs = Nothing
      objDB.Close
      Set objDB = Nothing
      GetCDRecords = "ERROR: " & Err.description
      End Function

      In ths ASP I used to get the array as follows,

      Set objCDs = Server.CreateOb ject("capitalCD .admin")
      Set objCDCatalog = objCDs.GetCDRec ords()
      arList = objCDCatalog("C DRecords")

      I wanted to make this function accessible via a web service.

      Thanks,

      Reddy





      "Nicholas Paldino [.NET/C# MVP]" <nicholas.paldi no@exisconsulti ng.com> wrote
      in message news:OgYV7rcVDH A.2212@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Srinivasa,
      >
      > If you could post the code for the objGetRecords method, then that[/color]
      would[color=blue]
      > help. Most likely, it is returning an object, or an array cast to an
      > object. Are the types all simple types?
      >
      >
      > --
      > - Nicholas Paldino [.NET/C# MVP]
      > - nicholas.paldin o@exisconsultin g.com
      >
      > "Srinivasa Reddy K Ganji" <gksreddy@adsgr oup.com> wrote in message
      > news:u0JoUbcVDH A.3924@tk2msftn gp13.phx.gbl...[color=green]
      > > I have a function written in vb 6 which returns an array of results[/color][/color]
      within[color=blue]
      > a[color=green]
      > > collection.
      > > In asp i get the array with this type of code
      > >
      > > arList = objGetRecords(" cdrecords")
      > >
      > > I generated wsdl file for this function using soap toolkit and the dll.[/color]
      > Then[color=green]
      > > added web reference to asp.net(c#) project and instantiated the[/color][/color]
      function.[color=blue][color=green]
      > > How do I retrieve the array of results here in c#? Any idea? Sample code
      > > would be nice.
      > >
      > > Thanks,
      > >
      > > Reddy
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...