vb.net中从字符串“”到类型“Integer”的转换无效。
PrivateSubTextBox6_TextChanged(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)Ha...
Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
Dim sdr As SqlDataReader
Dim sql As String
sql = "select 费率 from 收费标准信息表 where 车型='" + Me.TextBox2.Text + "'"
Dim mystr As String = "data source=.\SQLEXPRESS;initial catalog=高速公路收费系统;integrated security=true"
Dim myconn As New SqlConnection(mystr)
myconn.Open()
Dim feilu As String = ""
Dim sc As SqlCommand
sc = myconn.CreateCommand()
sc.CommandText = Sql
sdr = sc.ExecuteReader()
If (sdr.Read()) Then
feilu = (sdr("费率").ToString())
End If
sdr.Close()
myconn.Close()
Me.TextBox9.Text = CInt(feilu) * CInt(Me.TextBox6.Text)
End Sub
如图,我想输入公里数后金额自动计算,但按收费后, Me.TextBox9.Text = CInt(feilu) * CInt(Me.TextBox6.Text)这句提示从字符串“”到类型“Integer”的转换无效。 展开
Dim sdr As SqlDataReader
Dim sql As String
sql = "select 费率 from 收费标准信息表 where 车型='" + Me.TextBox2.Text + "'"
Dim mystr As String = "data source=.\SQLEXPRESS;initial catalog=高速公路收费系统;integrated security=true"
Dim myconn As New SqlConnection(mystr)
myconn.Open()
Dim feilu As String = ""
Dim sc As SqlCommand
sc = myconn.CreateCommand()
sc.CommandText = Sql
sdr = sc.ExecuteReader()
If (sdr.Read()) Then
feilu = (sdr("费率").ToString())
End If
sdr.Close()
myconn.Close()
Me.TextBox9.Text = CInt(feilu) * CInt(Me.TextBox6.Text)
End Sub
如图,我想输入公里数后金额自动计算,但按收费后, Me.TextBox9.Text = CInt(feilu) * CInt(Me.TextBox6.Text)这句提示从字符串“”到类型“Integer”的转换无效。 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询