1
 Me.SqlConnection1.ConnectionString = dbconn.ConnectionString

    Me.SqlDataAdapter1.SelectCommand.CommandText = "Select * From repSMI where Date Between '" & formSMI.DateTimePicker1.Value & "' and '" & formSMI.DateTimePicker2.Value & "'"
    Dim DsetSMI1 As New DataSet
    Me.DsetSMI1.Clear()
    Me.SqlDataAdapter1.Fill(Me.DsetSMI1, "repSMI")


    Dim x As New repSMI
    x.SetDataSource(Me.DsetSMI1)
    Me.CrystalReportViewer1.ReportSource = x
    Me.CrystalReportViewer1.Refresh()

对此有什么可能的解决方法?谢谢!

4

1 回答 1

0

你没有打开你的连接。而不是将其分配给您的命令。尝试添加

Me.SqlDataAdapter1.SelectCommand.Connection = Me.SqlConnection1
Me.SqlConnection1.Open();

Me.SqlConnection1.ConnectionString = dbconn.ConnectionString

DataSet 填满后不要忘记关闭它。

于 2013-09-21T14:51:17.827 回答