Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 17, 2012 01:35 PM by mezzanine74
May 14, 2012 07:18 AM|LINK
I have added 1 crystal report named CrystalReport1.rpt
I have added one form named form 1.
I have also added DataSet.xsd.
On form1 I have added 2 textboxes and one button and crystalreportviewer1.
The user enters from date and to date in the respective textboxes then the user clicks on
So,the report of that from date to todate will be shown.
The declarations are:
Private dataadapter As SqlDataAdapter
Dim str_com As String = "Data Source=COMPAQ\SQLEXPRESS;Initial
Dim objcon As SqlConnection
Dim objcmd As SqlCommand
Dim frmDate As DateTime
Dim toDate As DateTime
Dim rpt As New CrystalReport1()
The code I wrote in the button is:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
frmDate = Date.Parse(TextBox1.Text)
toDate = Date.Parse(TextBox2.Text)
The code for call function is:
Private Sub call1(ByVal frmDate As Date, ByVal toDate As Date)
Dim objcon As New SqlConnection("Data Source=COMPAQ\SQLEXPRESS;Initial
Dim str_con As String = "select * from IssueMBA where ida between '" + frmDate +
"' and ' " + toDate + "'"
objcmd = New SqlCommand(str_con, objcon)
Dim ds As New DataSet
Dim dataadapter As New SqlDataAdapter(objcmd)
CrystalReportViewer1.ReportSource = rpt
The code of loaded form is:
Private Sub issurepo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
objcon = New SqlConnection(str_com)
I am not getting any errors but neither its executing after clicking on button.
Kindly guide me.
May 17, 2012 01:35 PM|LINK
you need to provide data source of report on report server. Dataset of your report should have something like this
select * from IssueMBA where ida between @frmDate and @ToDate
As you can see, you should have two parameters with type of DateTime. Run your report on report server and make sure it is running properly. Your WebForm is the place where you provide two parameters from textBoxes for your report and ReportViewer will render