Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 9th, 2003, 12:33 PM
Registered User
Join Date: Sep 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Webservice displays only 1 instead of ALL results

Hi there

I've just started with webservices and have written a small function to get all the records from a database matching a date string.

Anyway, it seems to find the relevant records but only displays ONE and not all.

I've tried using datasets, datareaders, etc. all still give me one record instead of every one matching my criteria.

Here is my code for the function.

<WebService(Namespace:="http://ZeusProject.com")> _
Public Class Service3

    Inherits System.Web.Services.WebService

    <WebMethod()> Public Function getconnectiondate(ByVal connectiondate As DateTime) As connectiondateresult
        Dim Strconnect As String = dbstring2
        Dim objconnect As New OleDbConnection(Strconnect)
        Dim objcommand As New OleDbCommand()
        Dim results As New connectiondateresult()
        results.requestok = True
        Dim selectaudit As String = _
      "select * from accountdetails"

        objcommand.Connection = objconnect
        objcommand.CommandType = CommandType.Text
        objcommand.CommandText = selectaudit

        Dim objdataadapter As New OleDbDataAdapter()
        objdataadapter.SelectCommand() = objcommand

        Dim objdataset As New DataSet()
        objcommand.CommandText = selectaudit

        objdataadapter.Fill(objdataset, "Audit")

        Dim objDataView As New DataView()
        ' Dim objDataView2 As New DataView()
        ' Dim objDataView3 As New DataView()
        If objdataset.Tables(0).Rows.Count > 0 Then

            'If reader("connectiondate") = connectiondate Then

            'If reader.GetSqlDateTime("connectiondate") = "" Then

            'results.ismisc = True

            ' results.ismisc = False

            'End If
            results.exists = True
            Dim tbl As DataTable = objdataset.Tables("Audit")
            Dim row As DataRow = tbl.Rows(0)
            ' results.username = reader("username")

            results.username = row("username")

            'results.problemtype = reader("problemtype")
            'results.usernumber = reader("usernumber")

            results.requestok = False
            results.requestproblem = "Something's wrong"
        End If

        ' Else
        'results.requestok = False
        'results.requestproblem = "No Misc calls here dude"
        ' End If
        ' Catch e As Exception
        ' reportedexception(e, results)

        ' ' Finally
        ' If Not connection Is Nothing Then connection.Close()
        ' 'If Not reader Is Nothing Then reader.Close()

        ' End Try
        Return results
        ' End While
    End Function

Similar Threads
Thread Thread Starter Forum Replies Last Post
IE7 displays a blank page... thomasdrago XML 1 January 23rd, 2008 10:01 PM
Edit Query Results in Results Grid druid2112 SQL Server 2005 1 June 28th, 2007 08:49 AM
Report Displays Only One Record dlandolin Access 1 June 6th, 2007 12:18 PM
Crystal Report displays wrong value. shilpa_net2004 Crystal Reports 0 December 13th, 2005 04:30 AM
error message displays p2ptolu Classic ASP Databases 0 July 7th, 2005 04:27 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.