Hi! I am using crystal report to make my report. But problem is that I cant use same SQL Command there in report parameter because its different. I am going to show you my code so that you can understand it. I have a report & a form where I have one text box one button & one crystal report viewer. I have imported all fields by using report wizard. Even I have created parameter(name) there. So that user can get specific record by typing it there in the text box. However here is my code for button1:
Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared Public Class Form1 Inherits System.Windows.Forms.Form Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cryRpt As New ReportDocument cryRpt.Load(Application.StartupPath & "\CrystalReport1.rpt") Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldDefinition As ParameterFieldDefinition Dim crParameterValues As New ParameterValues Dim crParameterDiscreteValue As New ParameterDiscreteValue crParameterDiscreteValue.Value = TextBox1.Text crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields crParameterFieldDefinition = crParameterFieldDefinitions.Item("name") crParameterValues = crParameterFieldDefinition.CurrentValues crParameterValues.Clear() crParameterValues.Add(crParameterDiscreteValue) crParameterFieldDefinition.ApplyCurrentValues(crParameterValues) CrystalReportViewer1.ReportSource = cryRpt CrystalReportViewer1.Refresh() End Sub End Class
When I click on get report(button1) button. I get this type of result from result table.
ID Number Student`s name Subject`s name Obtained mark
DEN01010 John English 60
DEN01010 John Math 50
DEN01010 John Computer 70
I mean it shows student`s ID & name again & again in every row. Now I am going to show you what type of report I want to make.
ID Number Student`s name
Subject`s name Obtained mark
It means it will not show student`s ID & name again & again. On the top of the report it will show student`s ID & name for once & depending on ID it will show student`s mark on report. I guess I have to use something like that Select * from result where text1.text = name of the parameter. But problem is that I cant use same command there in formula workshop. I guess you can feel it now what I am trying to do. Please help me & explain it step by step because I am just a beginner.