表单包含1个texbox用于保存学生ID和2个日期时间选择器以选择学生支付的月费,我可以选择所有学生的日期范围,无法从特定的一个学生过渡到Todate。
我收到错误....请帮助.......这是我的问题代码
Dim dbCommand As New OleDb.OleDbCommand
Dim myreport As New CrystalReport2
Dim Dt As New DataTable
Dim da As New OleDb.OleDbDataAdapter
dbCommand.CommandText = "Select FeesMonth between #" & FromDate.Text & "# and #" & ToDate.Text & "# From StudentPayments Where StudentID= '" & TextBox1.Text & "'"
da.SelectCommand = dbCommand
da.Fill(Dt)
myreport.SetDataSource(Dt)
CrystalReportViewer1.ReportSource = myreport
CrystalReportViewer1.Show
答案 0 :(得分:0)
你必须将Connectionstring赋予dbCommand。
喜欢 -
OleDbConnection con = new OleDbConnection();
<强> dbCommand.Connectionstring = CON; 强>