嗨我是vb的新手,我想在我的msgbox中显示文本和变量,但我似乎无法弄明白。我的代码是
Data = "UPDATE [Mc_Koy].[dbo].[User] SET [Balance] = [Balance] - '" & txt_fare.Text & "'WHERE [ID] = '" & txtbox_id.Text & "'"
Command = New SqlCommand(Data, Connection)
Command.ExecuteNonQuery()
Dim Data1 As String = "SELECT [Balance] FROM [Mc_Koy].[dbo].[User] Where [ID] = '" & txtbox_id.Text & "'"
Dim Command1 As New SqlCommand(Data1, Connection)
Command1.ExecuteNonQuery()
Dim dr As SqlDataReader
dr = Command1.ExecuteReader
With dr
.Read()
Dim f As Double
MsgBox("Current Balance is ", .Item(0))
.Close()
End With
但是当我运行它时它只显示消息“当前余额是:”
答案 0 :(得分:5)
我认为您要将其附加到字符串中,因此请使用&
:
MsgBox("Current Balance is " & .Item(0))