codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  webservice query question  sanderman at 16:52 on Sunday, August 14, 2005
 

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


  Re: webservice query question  javabits at 09:19 on Tuesday, August 16, 2005
 

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...

  Re: webservice query question  sanderman at 09:28 on Tuesday, August 16, 2005
 

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








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Finding File Size and Creating Error log
•  Ajax example: online chat
•  Re: Nested Javascripts
•  ISP says linefeeds are causing problems
•  Linker Error Unresolved External Borland Builder 2006
•  Have multiple ASP.NET web projects share pages and controls
•  Re: How can I read ASCII data file in C++
•  Trouble writing programs
•  Validation Problem


Recent Articles
What is a pointer in C?
Multiple submit buttons with form validation
Understanding Hibernate ORM for Java/J2EE
HTTP screen-scraping and caching
a javascript calculator
A simple way to JTable
Java Native Interface (JNI)
Parsing Dynamic Layouts
MagicGrid
Caching With ASP.Net


© Copyright codetoad.com 2001-2006