Data Mining

Download Free Data Mining Source Code In C/C++, C#, Visual Basic, Visual Basic.NET, Java,
and other programming languages
Welcome to Data Mining Sign in | Join | Help
in Search

Data Mining Source Code Newsletter

Business Analyst Training
Live, Online, Video Courses
Instructor-Led + Hands-On
BusinessAnalystBootCamp.Com

SQL + Database Training
Live, Online, Video Classes
Instructor-Led + Hands-On
SQLBootCamp.Com

Software Developer Training
Live, Online, Video Courses
Instructor-Led + Hands-On
SoftwareDevelperBootCamp.Com

IT CAREER COACH
Hands-On Experience Coaching
IT Skills Training
IT-Career-Coach.NET

IT Professional Newsletter
"Free" IT Career Success Tips
How To Accelerate Your Career
IT Career Newsletter

Ask IT Career Questions
"ASK" A Burning IT Career
Question Or Get Answers
Ask A Burning IT Question Now!

Announcing The Data Mining Source Code Newsletter!

Subscribe By Email | Subscribe By RSS Feed

How to create basic webservices which returns string data as well or XML record set from SQL Server database.

Last post 09-28-2003, 14:00 by Kingsley Tagbo. 2 replies.
Sort Posts: Previous Next
  •  09-12-2003, 13:22 683

    How to create basic webservices which returns string data as well or XML record set from SQL Server database.

    Attachment: TestDataService.zip
    How to create basic webservices including webmethod which returns string data as well as webmethod which returns XML record set from SQL Server database.

    At database part no special table need to be created it uses default database and tables in SQL Server 7 intallation.

    This example will let you know and make you familiar with basic webservices concepts although i have commented the codes but if you still have any problem in understanding the code please let me know.



    --------------------------------------------------------------------------------


    '------------------------------------------------------------------------------
    '
    ' This code was generated by a tool.
    ' Runtime Version: 1.1.4322.510
    '
    ' Changes to this file may cause incorrect behavior and will be lost if
    ' the code is regenerated.
    '
    '------------------------------------------------------------------------------

    Option Strict Off
    Option Explicit On

    Imports System
    Imports System.ComponentModel
    Imports System.Diagnostics
    Imports System.Web.Services
    Imports System.Web.Services.Protocols
    Imports System.Xml.Serialization

    '
    'This source code was auto-generated by Microsoft.VSDesigner, Version 1.1.4322.510.
    '
    Namespace localhost

    '
    System.ComponentModel.DesignerCategoryAttribute("code"), _
    System.Web.Services.WebServiceBindingAttribute(Name:="DataService1Soap", [Namespace]:="http://tempuri.org/DataService1/Service1")> _
    Public Class DataService1
    Inherits System.Web.Services.Protocols.SoapHttpClientProtocol

    '
    Public Sub New()
    MyBase.New
    Me.Url = "http://localhost/DataService1/Service1.asmx"
    End Sub

    '
    _
    Public Function Add(ByVal a As Integer, ByVal b As Integer) As Integer
    Dim results() As Object = Me.Invoke("Add", New Object() {a, b})
    Return CType(results(0),Integer)
    End Function

    '
    Public Function BeginAdd(ByVal a As Integer, ByVal b As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
    Return Me.BeginInvoke("Add", New Object() {a, b}, callback, asyncState)
    End Function

    '
    Public Function EndAdd(ByVal asyncResult As System.IAsyncResult) As Integer
    Dim results() As Object = Me.EndInvoke(asyncResult)
    Return CType(results(0),Integer)
    End Function

    '
    _
    Public Function Multiply(ByVal a As Integer, ByVal b As Integer) As Double
    Dim results() As Object = Me.Invoke("Multiply", New Object() {a, b})
    Return CType(results(0),Double)
    End Function

    '
    Public Function BeginMultiply(ByVal a As Integer, ByVal b As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
    Return Me.BeginInvoke("Multiply", New Object() {a, b}, callback, asyncState)
    End Function

    '
    Public Function EndMultiply(ByVal asyncResult As System.IAsyncResult) As Double
    Dim results() As Object = Me.EndInvoke(asyncResult)
    Return CType(results(0),Double)
    End Function

    '
    _
    Public Function RetrieveData(ByVal sql As String) As System.Data.DataSet
    Dim results() As Object = Me.Invoke("RetrieveData", New Object() {sql})
    Return CType(results(0),System.Data.DataSet)
    End Function

    '
    Public Function BeginRetrieveData(ByVal sql As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
    Return Me.BeginInvoke("RetrieveData", New Object() {sql}, callback, asyncState)
    End Function

    '
    Public Function EndRetrieveData(ByVal asyncResult As System.IAsyncResult) As System.Data.DataSet
    Dim results() As Object = Me.EndInvoke(asyncResult)
    Return CType(results(0),System.Data.DataSet)
    End Function
    End Class
    End Namespace
  •  09-26-2003, 11:19 824 in reply to 683

    Could you supply some additional information

    Hi DotNetSmart

    Thanks for the sample. I am having some trouble with it, perhaps you can help.

    I downloaded the sample but am unable to get it to work.

    I put the DataService1 folder in localhost/wwwroot and create a virtual folder.
    Next I ran the TestDataService and I receive the error "Unable to start debugging on the web server. The project is not configured to be debugged."

    Which folders go where?

    Also, I am very much interested in a sample that will return a dataset to a Windows Form instead of an ASP.NET web form. Do you happen to have an example of how to do this?

    Thank you for your response

    Tim Conway
  •  09-28-2003, 14:00 832 in reply to 824

    Unable to start debugging on the web server. The project is not configured to be debugged

    Dear TConway,

    The error message probably means that your IIS Server or Visual Studio .NET configuration does not allow you to run the project and debug it at the same time.

    Their should not be much of a difference between the web application and windows application.

    Databind the same data displayed in a Web Form to a Windows Control like a DataGrid and you will get the same data displayed.

    Thanks


    Sign-up For Data Mining Source Code Newsletter

Announcing The Data Mining Source Code Newsletter!

Subscribe By Email | Subscribe By RSS Feed