I need to know how can I get specific record there in report by passing string parameter from vb.net to crystal reports? For example - I have text box, button & crystalreportviewer there in my form. When user will use it he will write specific word there in the text box & click on view report button then it will automaticlly find out the specific record & show it there in report. Please help me.

Hi kingcoder,

Here's what you need to do.
First, from the database Fields of the crystal report, create a new connection and then add a 'command'.Then edit the command to write your query with parameter. For example:

select Custname from table1 where cid={?@cid}

Here "{!@cid}" is the parameter that you create in the command. Now all you need to do is pass the textbox value into this parameter. Here's how:
In your form, add the following code to 'viewReport' button to pass the textbox value into crystal report's parameter.

crpt.RecordSelectionFormula = "{command.cid}= " & textbox1.text & ""

Finally include your rest of the code to load report source and load the crystal report.

Bye

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.