1
Public Class Form5
Dim CrystalReportViewer1 As Object
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "thulasi" Then
Form3.Show()
Else
MsgBox("Incorrect password ! Try again", MsgBoxStyle.OkOnly, "Thulasi-Restaurent")
Exit Sub
End If
Me.Close()
Dim ds As New DataSet
Dim str As String
str = "select * from billall where bdate between #" & DateTimePicker1.Value.Date & "# and #" & DateTimePicker2.Value.Date & "# order by indate"
Cn.Open()
Dim adap As New OleDbDataAdapter(str, Cn)
adap.Fill(ds, "billall")
Dim doc1 As New ReportDocument
doc1.Load("D:\billing\DuraiRestaurent\CrystalReport2.rpt")
doc1.SetDataSource(ds)
CrystalReportViewer1.CrystalReport2.ReportSource = doc1
Cn.Close()
End Sub
End Class
当试图执行OleDBException
时发生错误:“没有给出一个或多个所需参数的值”。你能帮我吗?VB动态SQL查询不起作用
您正在使用什么数据库,SQL,ORAC; E,MySQL的等? –
看起来像是一个ACCESS数据库。你能否确认字段“indate”是否是表billall上的有效字段? –
您好kelly我在我的数据库indate,但无法找到问题无论如何,我已经通过创建一个新的查询访问数据库本身与表中的SQL查看选项,现在工作很好,谢谢你的答复。 –