不能在报表中使用SQL表达式 [英] SQL Expression Can Not Be Used In Report
本文介绍了不能在报表中使用SQL表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好朋友,
我正在Vb.Net上使用Crystal Report,但出现如下错误
"SQL表达式不能在报表中使用".
Hello Friends,
i am working with Crystal Report with Vb.Net i got the Error like as below
" SQL Expression Can Not Be Used In Report".
Dim rpttitle As String = "All Data Of Employee"
Dim rptcomment As String
con = New SqlConnection("Data Source=192.168.101.102;Initial Catalog=test_data;Persist Security Info=True;User ID=wml;Password=win")
con.Open()
'cmd = New SqlCommand("select * from test where dt ='" & Format(CType(DateTimePicker1.Text, Date), "MM/dd/yyyy") & "' , con)
'cmd.ExecuteNonQuery()
adpt = New SqlDataAdapter("select * from test where dt between'" & Format(CType(DateTimePicker1.Text, Date), "MM/dd/yyyy") & "'and '" & Format(CType(DateTimePicker2.Text, Date), "MM/dd/yyyy") & "' order by dt", con)
ds = New Data.DataSet
adpt.Fill(ds)
If ds.Tables(0).Rows.Count > 0 Then
Dim strRptName As String = "D:\Dipak Nakum\Fil_Pipe_Calculator\Fil_Pipe_Calculator\WindowsApplication1\reports\Report1.rpt"
rptcomment = "Date Between " & Format(CType(DateTimePicker1.Text, Date), "dd/MM/yyyy") & " And " & Format(CType(DateTimePicker2.Text, Date), "dd/MM/yyyy")
rpt.Load(strRptName)
rpt.SetDatabaseLogon("wml", "win")
rpt.SetDataSource(ds.Tables(0))
rpt.SummaryInfo.ReportTitle = rpttitle
rpt.SummaryInfo.ReportComments = rptcomment
CrystalReportViewer1.ReportSource = rpt
如果
结束
结束子
在我想要输出的数据集中,我进入了数据集.我已经调试完deelpy bu ti直到最后一行都没有发现任何错误,直到最后一行都没有出现任何错误,然后在显示了上述错误之后.
end if
end sub
in the dataset which ever is output i want is i got in the dataset . i have done debugging deelpy bu t i don''t found any error till last line, there is no any error comes till last line , then after above error was shown.
推荐答案
也只需提供父驱动器特定报告的完整路径.
Just give the full path of particular reports with the parent drive also.
这篇关于不能在报表中使用SQL表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文