【问题标题】:End of statement expected. - VB Code to WebService Error预期语句结束。 - VB 代码到 WebService 错误
【发布时间】:2015-12-23 16:30:29
【问题描述】:

我在尝试在 Visual Studio 中调试我的 VB 代码以与特定 WebService 交互时遇到此错误。 我对 Visual Basic 不是很熟悉。 错误在线Dim ticket_handle As String = " CR 1001 " ws.closeTicket ( Sid , " closed ticket " ticket_handle ) 完整代码:

Imports System.IO Imports System.Xml
Imports System.Xml.Serialization
Imports WebReference
Partial Class _Default

Inherits System.Web.UI.Page

Dim ws As New USD_WebService
Dim sid As String
Dim userhandle, username, password As String
Dim attrVal(5), attr(0), prop(0) As String
Dim requestHandle, requestNumber As String
Dim persistent_id As String
Dim catAttrib(5) As String
Sub Main()
    Dim ws As New USD_WebService
    ws.Url = "http://hummer:8080/axis/services/USD_R11_WebService?wsdl"
    Dim username, password
    Dim sid
    username = "servicedesk"
    password = "password"
    sid = ws.login(username, password)

    Dim userhandle
    userhandle = ws.getHandleForUserid(sid, username)

    Dim USD As New WebReference.USD_WebService
    sid = USD.login(username, password)
    Dim ticket_handle As String = “cr:1001” ws.closeTicket(Sid,“ticket fechado”, ticket_handle)

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    ws.Url = "http://hummer:8080/axis/services/USD_R11_WebService?wsdl"

End Sub
End Class

谁能帮帮我?!?!

【问题讨论】:

    标签: vb.net web-services


    【解决方案1】:

    在 VB.NET 中,每行只能执行一条语句。其他语言,如 Java 或 C# 使用 ';'表示语句的结尾,但是在 VB.NET 中它是行的结尾。编译器试图告诉您一行中有两条语句,并且它希望只有一条。

    Dim ticket_handle As String = “cr:1001” ws.closeTicket(Sid,“ticket fechado”, ticket_handle)
    

    应该是

    Dim ticket_handle As String = “cr:1001” 
    ws.closeTicket(Sid,“ticket fechado”, ticket_handle)
    

    【讨论】:

    • 如果你使用'line join'字符——一个冒号,你可以在VB中的每一行有多个语句。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-06
    相关资源
    最近更新 更多