Run Procedure through a VB.Net Webservice

Asked

Viewed 95 times

0

I’m making a Webservice to access a trial I did. I’m having a hard time being new in the area. First I made the class with the public properties that would store the values to more part pass to Procedure which in turn will insert data in the database.

There is my class

Public Class clsMaquinario

    Private _container As String
    Private _statusMaq As String
    Private _usuario As String
    Private _data As String

    Public Property Container() As String
        Get
            Return _container
        End Get
        Set(ByVal value As String)
            _container = value
        End Set
    End Property

    Public Property StatusMaq() As String
        Get
            Return _statusMaq
        End Get
        Set(ByVal value As String)
            _statusMaq = value
        End Set
    End Property

    Public Property Usario() As String
        Get
            Return _usuario
        End Get
        Set(ByVal value As String)
            _usuario = value
        End Set
    End Property

    Public Property Data() As String
        Get
            Return _data
        End Get
        Set(ByVal value As String)
            _data = value
        End Set
    End Property


End Class

I am doing this based on another ready. My doubt is the following, put the method to access the bank and run the process in the class itself? And if so, how? Because I have an example that I was given to follow only without Procedure, sending the select directly to the Bank. The Example is this:

Function LIB_VAZIO_EXPORTACAO_INTERNO(ByVal Container As String) As clsLibVazioExportacao

        Dim StrSql As String
        Dim libVazio As New clsLibVazioExportacao
        Dim rscmdAux As SqlClient.SqlDataReader
        Dim acessa As New AcessoDAO.Banco

        Try
            StrSql = ""
            StrSql = StrSql & "Select Cod_Armador, Nome_Armador, Conteiner, Tipo_Iso, "
            StrSql = StrSql & "Tipo, Tara, Mgw, N_Booking, N_Lacre, Cod_Porto, "
            StrSql = StrSql & "Nome_Porto, Dt_Saida, Nome_Exportador, Num_Intercambio "
            StrSql = StrSql & "from v_lib_exportacao_interno "
            StrSql = StrSql & "where Conteiner = '" & Container & "'"

            rscmdAux = acessa.RetornaDataReader(StrSql)

     ............

        Return libVazio

    End Function
  • Jonas take a look at this example: http://csharpbrasil.com.br/criando-e-consumindo-web-service-em-c-sharp-parte-1/

  • Nice article, explains well the operation of a webservice. I don’t think I’m succeeding because I don’t know the basics about it, because they already give me a code ready... Can anyone help me with the resolution and try to explain why ? Thank you

  • for you to access your webservice class, you can create a Static method and access it see the very simple example. http://pastebin.com/Bbp4s5J6

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.