|
hi coders,
i have made a webservice that pull data from an access database...i am gonna use this webservice in flash mx...
the webservice works but the problem is that i only get the first record from the database and i need all the records so
flash can handle the webservice.....
this is my code database path etc etc not included:
<WebMethod(CacheDuration:=5)> _
Public Function Merken(intAdId As String) As AdInfo
Dim cmdClasf As OleDbCommand
Dim rdrMembers As OleDbDataReader
Dim strSQL As String
Dim adiCurrent As AdInfo = New AdInfo()
strSQL = _
"SELECT * " & _
"FROM collection "
OpenDb()
cmdClasf = New OleDbCommand(strSQL, conClasf)
rdrMembers = cmdClasf.ExecuteReader
Do While rdrMembers.Read
adiCurrent.Found = True
adiCurrent.url = rdrMembers.Item("jpg_url")
adiCurrent.description= rdrMembers.Item("description")
adiCurrent.brand= rdrMembers.Item("brand")
Loop
conClasf.Close
return adiCurrent
End Function
End Class
I used the to while loop to loop through the records but it
just gives met 1 record hope someone can help....
thank in advance
greetzzz Sander
|
|
|
well looking at your code it seems you have a function which is returning a single AdInfo object, in this case since you go through the do while loop this would be the last AdInfo object returned from the query.
If you want to pass the results back from this query you would need to return a collection of AdInfo objects.
Either that or modify your webservice so it returns a single item at a time since you are passing in intAdId, it seems you would do a query for:
select * from collection where adid = intAdId
semper fi...
|
|
|
could you give a code example so it loops trough all the results i need all the records for the table collectie..
i thought something like this but it gives me no error but no records:
Public Class AdInfo
Public Found As String
Public url As String
Public omschrijving As String
Public merknaam As String
End Class
'verfijnen zoekopdrachten voor wsdl bijvoorbeeld
<WebMethod(CacheDuration:=5)> _
Public Function Merken As AdInfo
Dim cmdClasf As OleDbCommand
Dim rdrMembers As OleDbDataReader
Dim strSQL As String
Dim adiCurrent() As AdInfo
Dim i As Integer
strSQL = _
"SELECT * " & _
"FROM collectie "
OpenDb()
cmdClasf = New OleDbCommand(strSQL, conClasf)
rdrMembers = cmdClasf.ExecuteReader
ReDim adiCurrent(0)
Do While rdrMembers.Read
adiCurrent(i) = New AdInfo()
adiCurrent(i).Found = True
adiCurrent(i).url = rdrMembers.Item("jpg_url")
adiCurrent(i).omschrijving = rdrMembers.Item("omschrijving")
adiCurrent(i).merknaam = rdrMembers.Item("merknaam")
i = i + 1
ReDim Preserve adiCurrent(i)
Loop
i hope you can shed some light on this....
thank for you reply
regards Sander
|
|
|
|
|
|
|
|