vb中索引超出了数组界限 15
PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesBu...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.ComboBox1.SelectedIndex = -1 Then
MsgBox("请选择年份!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
Dim connum As Long
Dim consum As Double
Dim myconn As New OleDbConnection
Dim mycomm As New OleDbCommand
mycomm.connection = myconn
mycomm.CommandText = "select count(id),sum(csum) from contract where factor=true and factdate>=#" & CDate(Me.ComboBox1.SelectedItem & "-1-1") & "#and" & "factdate<=#" & CDate(Me.ComboBox1.SelectedItem & "-12-31") & "# "
Dim myreader As Oledbdatareader
myconn.open()
myreader = mycomm.ExecuteReader
While myreader.read
connum = myreader.GetInt32(0)
If consum = "0" Then
consum = 0
Exit While
Else
consum = myreader.GetDouble(1)
End If
End While
myconn.close()
Me.Label7.Text = "合同数目:" & connum & "交易金额:" & consum
End Sub
items设的是2000年到2018年, 是数组问题还是数组界限的问题呀,请大虾们帮解决一下啊!!!感激0.0 展开
If Me.ComboBox1.SelectedIndex = -1 Then
MsgBox("请选择年份!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
Dim connum As Long
Dim consum As Double
Dim myconn As New OleDbConnection
Dim mycomm As New OleDbCommand
mycomm.connection = myconn
mycomm.CommandText = "select count(id),sum(csum) from contract where factor=true and factdate>=#" & CDate(Me.ComboBox1.SelectedItem & "-1-1") & "#and" & "factdate<=#" & CDate(Me.ComboBox1.SelectedItem & "-12-31") & "# "
Dim myreader As Oledbdatareader
myconn.open()
myreader = mycomm.ExecuteReader
While myreader.read
connum = myreader.GetInt32(0)
If consum = "0" Then
consum = 0
Exit While
Else
consum = myreader.GetDouble(1)
End If
End While
myconn.close()
Me.Label7.Text = "合同数目:" & connum & "交易金额:" & consum
End Sub
items设的是2000年到2018年, 是数组问题还是数组界限的问题呀,请大虾们帮解决一下啊!!!感激0.0 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询