C
cj2
In the code below I want when this web service is first published for
the boolean Running.running to be True. It seems to default to false.
How can I make this default to True? Once the web service is running
and I call it with "start" it works fine as coded. I just don't want
to have to call it with start the first time.
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Data.Odbc
' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)> _
Public Class Running
Public Shared running As Boolean
End Class
Public Class CashOnly
Inherits System.Web.Services.WebService
Dim result As String
<WebMethod()> _
Public Function CashOnly(ByVal act As String) As String
If act = "stop" Then
Running.running = False
result = "stopped"
ElseIf act = "start" Then
Running.running = True
result = "started"
elseIf IsNumeric(act) And act.Trim.Length = 10 Then
If Running.running Then
Dim myDs As New DataSet
Dim myOdbcConnection As New
OdbcConnection("Driver={Microsoft Visual FoxPro Driver};" + _
"SourceType=DBF;" + _
"SourceDB=c:;" + _
"Exclusive=No;" + _
"Collate=Machine;" + _
"NULL=NO;" + _
"DELETED=NO;" + _
"BACKGROUNDFETCH=NO")
Dim myOdbcCommand As New OdbcCommand("select flag from
\\fileserver\i\probill\act_frau.DBF where act = '" + act.Trim + "'",
myOdbcConnection)
myOdbcConnection.Open()
result = myOdbcCommand.ExecuteScalar.ToString
myOdbcConnection.Close()
Else
result = "Try again later"
End If
Else
result = "Invalid request"
End If
Return result
End Function
End Class
the boolean Running.running to be True. It seems to default to false.
How can I make this default to True? Once the web service is running
and I call it with "start" it works fine as coded. I just don't want
to have to call it with start the first time.
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Imports System.Data.Odbc
' To allow this Web Service to be called from script, using ASP.NET
AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)> _
Public Class Running
Public Shared running As Boolean
End Class
Public Class CashOnly
Inherits System.Web.Services.WebService
Dim result As String
<WebMethod()> _
Public Function CashOnly(ByVal act As String) As String
If act = "stop" Then
Running.running = False
result = "stopped"
ElseIf act = "start" Then
Running.running = True
result = "started"
elseIf IsNumeric(act) And act.Trim.Length = 10 Then
If Running.running Then
Dim myDs As New DataSet
Dim myOdbcConnection As New
OdbcConnection("Driver={Microsoft Visual FoxPro Driver};" + _
"SourceType=DBF;" + _
"SourceDB=c:;" + _
"Exclusive=No;" + _
"Collate=Machine;" + _
"NULL=NO;" + _
"DELETED=NO;" + _
"BACKGROUNDFETCH=NO")
Dim myOdbcCommand As New OdbcCommand("select flag from
\\fileserver\i\probill\act_frau.DBF where act = '" + act.Trim + "'",
myOdbcConnection)
myOdbcConnection.Open()
result = myOdbcCommand.ExecuteScalar.ToString
myOdbcConnection.Close()
Else
result = "Try again later"
End If
Else
result = "Invalid request"
End If
Return result
End Function
End Class