Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
plaese help to solve this crystal report printing problem for school program

form having 1 textbox for Student ID and two date picker & access database stored Student ID, Fees month, Amount & Date of Payment.Print the Crystal report of Particular Student with given date of Range & code as follows, which is not working (showing only plan sheet)
Dim myreport As New CrystalReport21

dbCommand.CommandText = "SELECT * From StudentPayments Where StudentID ='" & CStr(TextBox1.Text) & "' and FeesMonth >='" & CDate(FromDate.Text) & "' and FeesMonth <='" & CDate(ToDate.Text) & "'"

da.SelectCommand = dbCommand
da.Fill(Dt)
myreport.SetDataSource(Dt)
CrystalReportViewer1.ReportSource = myreport
CrystalReportViewer1.Show()
Posted
Updated 30-Sep-13 8:40am
v2
Comments
Kschuler 2-Oct-13 15:21pm    
What do you mean not working? Have you debugged? What is in the Dt? Is it not pulling back any data? What data type is the FeesMonth column? We need more information to help.
bharat901 3-Oct-13 12:14pm    
Thanks for your replay..... still i need help....
It is not puling any data from access database and FeesMonth column data type is 'datetime', only plain sheet will display
Kschuler 3-Oct-13 12:20pm    
If you are not getting any data from the access database then it's your SQL statement that needs fixing, not the Crystal report. You likely do not have the date formatted in a way that access recognizes. You can google to find out the syntax that is needed, or if you look at the link in the solution thatraja posted, there is a sample that uses parms instead. Parms are nice because it knows when things are strings/numeric/dates, etc. And they help avoid sql injection attacks.
Kschuler 3-Oct-13 12:22pm    
As for syntax...I googled and found this: http://stackoverflow.com/questions/12270816/datetime-format-issue-in-vb-net-with-ms-access-database-when-using-sql-statement
bharat901 3-Oct-13 12:33pm    
thank u sir, let me look those examples and i will come back....
thanks once again.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900