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
DEN01010 John

Subject`s name Obtained mark
English 60
Math 50
Computer 70

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.

huumn.use group by student`s ID & name in your query. so first it will group all the student with the given iD or name and then display the reult. it will show only one recored when you pass parameter.
Try this if problem is solved mark as solved

huumn.use group by student`s ID & name in your query. so first it will group all the student with the given iD or name and then display the reult. it will show only one recored when you pass parameter.
Try this if problem is solved mark as solved

huumn.use group by student`s ID & name in your query. so first it will group all the student with the given iD or name and then display the reult. it will show only one recored when you pass parameter.
Try this if problem is solved mark as solved

I have tried to follow your advice. But it doesnt work. Let me make it clear to you. Listen I have a table called result ok? When user creates result for Tom it saves data in the table like that -

ID - Name - Subject - Oral mark - Written mark - Total mark
1 - Tom - English - 20 - 40 - 60

However after doing that table gets one row right? When user creates another result for another subject[for the same student] then it saves data in the table like that -

1 - Tom - Computer - 30 - 40 - 70

As a result table gets another row for it. So tables look like -

ID - Name - Subject - Oral mark - Written mark - Total mark
1 - Tom - English - 20 - 40 - 60
1 - Tom - Computer - 30 - 40 - 70

If you add another results it will look like -

ID - Name - Subject - Oral mark - Written mark - Total mark
1 - Tom - English - 20 - 40 - 60
1 - Tom - Computer - 30 - 40 - 70
1 - Tom - Math - 25 - 55 - 80

Now if we normally create report it will be something like that

ID - Name - Subject - Oral mark - Written mark - Total mark
1 - Tom - English - 20 - 40 - 60
1 - Tom - Computer - 30 - 40 - 70
1 - Tom - Math - 25 - 55 - 80


That means though ID & Name is same it will show it again & again there in every row[1 1 1 Tom Tom Tom]. I need to make a report where report will show ID & name for once & subjects will be perfect like that -

ID - 1 Name - Tom

Subject - Oral mark - Written mark - Total mark
English - 20 - 40 - 60
Computer - 30 - 40 - 70
Math - 25 - 55 - 80

Is it clear now? When user will save results for different subjects it will get same ID & Name again & again there in every row but it will not show it again & again when it will show report. Thats all I want to do. You said I have to group ID & Name right? I did but its not working because it shows ID & Name again & again there in report. Now would you please tell me how should I solve this problem?

ok will get your question. when you create report first use group by query as per i told you. then when you place the fild in crystal report that time Only
Subject,Oral Mark,Written Mark,Total Mark place on your details section. and Id And name filed place on page header section and then pass the value you will get the result as you want when you run the report.

helllo can someone help me to view the record in crystal report when i clicked the print button..
it's like a printing receipt..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.