retreive array

  • Thread starter Thread starter Srinivasa Reddy K Ganji
  • Start date Start date
S

Srinivasa Reddy K Ganji

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
 
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?
 
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 GetCDRecordsErrHandler

Set objDB = New ADODB.Connection
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

GetCDRecordsErrHandler:
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.CreateObject("capitalCD.admin")
Set objCDCatalog = objCDs.GetCDRecords()
arList = objCDCatalog("CDRecords")

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

Thanks,

Reddy





Nicholas Paldino said:
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]
- (e-mail address removed)

Srinivasa Reddy K Ganji said:
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
 
Back
Top