我创建了一个名为的类Cls_ICCID
,在其中声明了Update_Status
返回 byRef 变量的方法。
Cls_ICCID
Public Sub Update_Status(**ByRef massege As String**, ByVal ICCID_No As Integer, ByVal status As Integer)
Try
Dim cmd As SqlCommand
Dim sql As String
Dim myConnection As SqlConnection = New SqlConnection()
myConnection.ConnectionString = "Data Source=TEHRANI\TEHRANI;Initial Catalog=GSMProduction;Persist Security Info=True;User ID=sa;Password=1"
sql = "UPDATE Tbl_ICCID SET Status=status WHERE ICCID=ICCIDNo"
myConnection = New SqlConnection(sql)
myConnection.Open()
cmd = New SqlCommand(sql, myConnection)
cmd.ExecuteNonQuery()
cmd.Dispose()
myConnection.Close()
massege = "SeccessFully"
Catch ex As Exception
massege = "server Error"
End Try
End Sub
然后在触发文本框更改事件时执行该方法:
Private Sub Txt_ICCID_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Txt_ICCID.TextChanged
Dim clsICCID As Cls_ICCID
clsICCID.Update_Status(lblError.Text, Txt_ICCID.Text, 1)
End Sub
但这给了我一个例外:
算术运算导致溢出。 我究竟做错了什么?