|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Restriction of Data in Crystal Report
Hello World
I am working on a crystal Report for my application but it seems that I have always same results despite I made SQL restriction for the Data set. Can someone help on that problem. Any Clue ? Code:
ShowReport.Show()
Dim requestedReportDate1 = CInt(Me.ReportDatePicker.Value.Day)
Dim requestedReportDate2 = CInt(Me.ReportDatePicker.Value.Month)
Dim requestedReportDate3 = CInt(Me.ReportDatePicker.Value.Year)
Dim Conn As New SqlConnection("data source =.; database=dentistdata;integrated security = true")
Dim str = "select pfirstname,pmidname,plastname,paid from patientinfo where prday=@day and prmonth=@month and pryear=@year "
Dim ds As New DataSet
Dim ad As New SqlDataAdapter(str, Conn) 'ad.SelectCommand.Parameters.Add("@day", SqlDbType.Int).Value = requestedReportDate1 'ad.SelectCommand.Parameters.Add("@month", SqlDbType.Int).Value = requestedReportDate2 'ad.SelectCommand.Parameters.Add("@year", SqlDbType.Int).Value = requestedReportDate3
ad.Fill(ds, "patientinfo")
Dim c As New reportDocument1
c.SetDataSource(ds)
Dim f As New ShowReport ' f.CrystalReportViewer1.ReportSource = c f.CrystalReportViewer1.Show()
Thanx |
|
#2
|
||||
|
||||
|
OK First, as I understand it the single quote (') is for comments so all of the SelectCommand.AddParameter statements are commented out.
Since you have the necessary values why not just build your sql string with these values like so: Code:
Dim str = "select pfirstname,pmidname,plastname,paid from patientinfo where prday = " & requestedReportDate1 & " and prmonth = " & requestedReportDate2 & " and pryear = & requestedReportDate3
Dim ds As New DataSet
Dim ad As New SqlDataAdapter(str, Conn)
__________________
P.S. I am looking for work. <grin>. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Restriction of Data in Crystal Report |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|