follow frodoman's steps and it should work.
this code may also help to keep your syntax neat. parameter passing was made possible with a single line of code, ie
rpt.SetParameterValue("{?f
Main Topics
Browse All TopicsI am new to Crystal Report. I am using VB.NET and Crystal Report 8.5
I created a report, when connecting to the database, I only see tables but not store procedures, I have all the access rights but the store procedures not show up in the wizards. Any way, I just select the table name Fabric and field names.
I want to display only one record, I look at show sql statement:
SELECT "Fabric"."FabricID", "Fabric"."CustomerID", "Fabric"."FabricCode", "Fabric"."SMProjectName", "Fabric"."SMPlanID", "Fabric"."SMRoomName", "Fabric"."SupplierName", "Fabric"."PatternAndColor"
FROM "enterprise"."dbo"."Fabric
WHERE "Fabric"."FabricID"=222049
The FabricID need to be a parameter field. So I insert a "Record Selection Formula" and name the field "fabricParam" and it formula was {Fabric.FabricID} = 222049.
My Webform1.aspx.vb code is:
Imports CrystalDecisions.CrystalRe
Imports CrystalDecisions.Shared
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.Debugg
End Sub
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.Cryst
'Dim crpt As CrystalReport1
Dim crpt As crFabricLabel
Dim myTable As CrystalDecisions.CrystalRe
Dim myLogin As CrystalDecisions.Shared.Ta
Private designerPlaceholderDeclara
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
'crpt = New CrystalReport1
crpt = New crFabricLabel
For Each myTable In crpt.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Pas
myLogin.ConnectionInfo.Use
myTable.ApplyLogOnInfo(myL
Next
Dim crParameterFieldDefinition
Dim crParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
'Set discrete value
crParameterDiscreteValue.V
'Access first parameter field definition
crParameterFieldDefinition
crParameterFieldDefinition
' Add parameter value
crParameterValues = crParameterFieldDefinition
crParameterValues.Add(crPa
' Apply the current value to the parameter definition
crParameterFieldDefinition
CrystalReportViewer1.Repor
End Sub
End Class
When run the web form I got this error:
Exception Details: CrystalDecisions.CrystalRe
Source Error:
Line 51: 'Access first parameter field definition
Line 52: crParameterFieldDefinition
Line 53: crParameterFieldDefinition
Line 54:
Line 55: ' Add parameter value
So can anybody help me how to put in a parameter field into the Crystal report form so that {Fabric.FabricID} = some variable instead of a pre-defined number.
The error message tell me that I have not define fabricParam anywhere in the form but It is there.
I will get to how to get store procedure, but that will be next.
Many thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for the tips.
I bought the Crystal book today, and on the session adding a parameter. It said to add a parameter to a report select insert, field object.
However, when I right click on the crFabricLabel form designer, the drop down list insert field was gray out. Also, I go back to add/remove database to bring up the database wizards, I don't see any places for store procedure, it only give me tables and views, and don't see any check box.
So I think that I only have a basic Crystal Report engine. I installed Visual studio.net on my PC and using my local IIS 5.1, do we need addition installation for Crystal Report or down load from Microsoft any addition components?
I create this Crystal Report in ASP.NET by right click the project name in solution explorer and click add/new item. Then I choose Crystal Report.
By the way, we have MSDN version. Do we have separate Crystal DVD provided w/ MSDN DVD(s)? I haven't seen the whole MSDN diskettes yet. I worked for a very small company and a silly owner who want to take control of everything but very silly w/ hi-tech. So every time, if I mumbling “I am stupid”, then I correct myself right away, there is one even more stupid than you.
You indicated in your first posting that you're using CR8.5. It sounds like you're actually using the version that comes with Visual Studio which is a stripped down version of CR9 - is that correct?
Within VS to insert a parameter you need to look at the "Field Explorer" window, rt-click on "Parameter Fields", then select "Insert".
HTH
frodoman
You indicated in your first posting that you're using CR8.5. It sounds like you're actually using the version that comes with Visual Studio which is a stripped down version of CR9 - is that correct?
Within VS to insert a parameter you need to look at the "Field Explorer" window, rt-click on "Parameter Fields", then select "Insert".
HTH
frodoman
the field explorer can be hard to find in case it has been closed. this explains how to get it on screen
http://support.businessobj
crystal should be installed automatically with .net, by default it is selected to be installed. some lower versions of .net don't include crystal at all. not sure whiches ones have it though. if you click on "new item" you should see "crystal report", this would confirm if it has been installed correctly
U're right, I 've a stripped down version of Crystal Report. Not sure what version it is, my VS is 2003. Don't know how to tell what version of Crystal I had.
Thanks for every thing.
But I do have a question. Do you suggest this book
Professional Crystal Reports for Visual Studio.NET, 2nd Edition
By David McAmis
Publisher Wrox - A Branded Imprint of Wiley
This morning I came to San Diego Tech book store to get this, however they only have 3 books display on the book sheves. Don't want to wait for 7 - 15 shipping days, I picked up the Using Crystal Enterprise 8.5. I have to return this book. So I wonder it is worthed to exchange it with the above book. This owner is very creedy, I paid out of my pocket. I don't bother to ask him for reimbursement.
Thanks,
>>> Do you suggest this book Professional Crystal Reports for Visual Studio.NET, 2nd Edition
I haven't used that book so I can't say whether it's good or not. What I can tell you is
a) I've personally been fairly happy w/ other Wrox books that I've bought. Some were better than others but only one was really bad so the odds are in your favor. Check Amazon.com for reviews though and see what other people have said about it...
b) The Crystal Enterprise 8.5 book is going to be useless to you. Keep in mind that Crystal ENTERPRISE is not the same as Crystal REPORTS. They're cousins and they work together but they aren't the same thing. Also the Visual Studio version is much different than Crystal Reports 8.5.
Don't worry about the version - it's just the ".Net" version of Crystal which is an OEM version of Crystal Reports 9. It's not too stripped down - you can still do 90% of what the standalone version can do and it's still a great tool.
It's your call on the book. Personally I've never read a Crystal book - I picked it up by playing with it and of course w/ help from people on this site. If you have some time to work with it and can use this site as a resource then I'd save the money - if you don't have the time for trial and error then I'd definately look for a book like the one you mention. The .Net version is just different enough that you could get frustrated trying to learn with a "regular" Crystal book.
Good luck!
frodoman
I'm having a similar problem, I can pass the value (incidentally, Ewaldl, your suggestion works, but the short syntax is
rpt.SetParameterValue("fab
without the curly braces or question mark) and my sql command uses the parameters that I pass, specifically, my sql command is thus:
select * from [Runtime Library].dbo.CIFReportComm
however I am getting an empty recordset, as though I was passing nulls. I placed the actual parameter values on the report and they show up as having been set properly (in my case the parameters are both "test1" which in query analyzer returns a full recordset).
Hmmmm I can't figure this one out! Should I not be using a simply "command" data source?
Business Accounts
Answer for Membership
by: frodomanPosted on 2004-08-06 at 18:19:31ID: 11740981
It sounds like you've forgotten to create the parameter in your report. In the crystal designer you need to create a parameter named fabricParam of type number. Then you want to set your select expert to be
{Fabric.FabricID} = {?fabricParam}
Now you can pass the parameter from your application to Crystal and it should work as you want.
By the way, check your database options for the stored procedures. By default you see only tables but you can check the option to see stored procedures and views also if desired.
HTH
frodoman