I do this:
' Set the name of the parameter to modify.
paramField.ParameterFieldName = "P1"
' Set a value to the parameter.
paramValue.Value = strTemp
paramField.CurrentValues.Add(paramValue)
paramField.DefaultValues.Add(paramValue)
' Add the parameter to the ParameterFields collection.
paramFields.Add(paramField)
CrystalReportViewer.ParameterFieldInfo = paramFields
strReportSource = strReportSource & "Transaction For Specified Account.rpt"
CrystalReportViewer.ReportSource = strReportSource
But I get "Load reort failed".
Any suggestions...
Thanks....hi njuser,
if you get "load report failed" you do not have a problem with passing parameters, the report generator doesn't find the report!
when you call reportDocument.Load() it needs the path of the report like this: ( use the full path of the report-file )
"c:\\inetpub\\wwwroot\\reports\\myreport.rpt"
important are the "\\", the reportdocument class don't accept a single "\".
if you have problems with passing parameters you get a message like:
"current parameter-value missing"
cu,
tomcat
Showing posts with label crystal. Show all posts
Showing posts with label crystal. Show all posts
Wednesday, March 21, 2012
Problem passing parameter from VB.Net 2005 to crystal - code included
I am trying to pass a few parameters to crystal from vb.net 2005. Here is what I have, and it is not working. Everything else on the report works fine. Any ideas?
It is asking me to enter the value in a new window when the report loads..."You can provide a single value for this parameter. Enter the value you want to include........."
Dim strReportPath1 As String = "MainSummary"
Dim strConnection As String = "Data Source=localhost;Integrated Security=SSPI;" & _
"Initial Catalog=Carc2;"
Dim Connection As New SqlConnection(strConnection)
Dim strSQL As String = "My Select statement is here...too long to show in code"
Dim DA As New SqlDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS, "SummaryInfo")
Dim strReportPath As String = Application.StartupPath & "\" & strReportPath1 & ".rpt"
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
If frmSummaryRpt.RadioShip.Checked = True Then
cr.SetParameterValue("ShipDate", frmSummaryRpt.txtStart.Text & " - " & frmSummaryRpt.txtEnd.Text)
ElseIf frmSummaryRpt.RadioShip.Checked = False Then
cr.SetParameterValue("ShipDate", "No ShipDate Selected")
End If
cr.Load(strReportPath)
cr.SetDataSource(DS.Tables("SummaryInfo"))This is resolved. The problem was that my if statements were before the report was loaded. I moved the area that they occured and it worked finesql
It is asking me to enter the value in a new window when the report loads..."You can provide a single value for this parameter. Enter the value you want to include........."
Dim strReportPath1 As String = "MainSummary"
Dim strConnection As String = "Data Source=localhost;Integrated Security=SSPI;" & _
"Initial Catalog=Carc2;"
Dim Connection As New SqlConnection(strConnection)
Dim strSQL As String = "My Select statement is here...too long to show in code"
Dim DA As New SqlDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS, "SummaryInfo")
Dim strReportPath As String = Application.StartupPath & "\" & strReportPath1 & ".rpt"
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
If frmSummaryRpt.RadioShip.Checked = True Then
cr.SetParameterValue("ShipDate", frmSummaryRpt.txtStart.Text & " - " & frmSummaryRpt.txtEnd.Text)
ElseIf frmSummaryRpt.RadioShip.Checked = False Then
cr.SetParameterValue("ShipDate", "No ShipDate Selected")
End If
cr.Load(strReportPath)
cr.SetDataSource(DS.Tables("SummaryInfo"))This is resolved. The problem was that my if statements were before the report was loaded. I moved the area that they occured and it worked finesql
Monday, March 12, 2012
Problem of calculation COUNT in Crystal Report
The problem is:
There is a table in SQl and has 3 columns eg Col 1, Col2, Col3.
& they have following entries.
Col1 Col2 Col3
11 12 A
33 32 B
10 10 B
40 50 A
Now i want the count of the tabel where Col3 is B.
The result should return me 2
It should be displayed under one heading.
Also i want the count of the tabel where Col3 is A
The result should return me 2
It should be displayed under another heading.
I have done it using a command and Stored Procedure.
But i dont want to do with them.
I want a formula to be used in crystal report (Formula editor/ SQL Expression)
Please, if any1 can help me outhai,
Use Running Total fields, give the conditions in the Running Total Field Formulas. hope this will works you better. let me know the status.
regards,
Bhuvana
There is a table in SQl and has 3 columns eg Col 1, Col2, Col3.
& they have following entries.
Col1 Col2 Col3
11 12 A
33 32 B
10 10 B
40 50 A
Now i want the count of the tabel where Col3 is B.
The result should return me 2
It should be displayed under one heading.
Also i want the count of the tabel where Col3 is A
The result should return me 2
It should be displayed under another heading.
I have done it using a command and Stored Procedure.
But i dont want to do with them.
I want a formula to be used in crystal report (Formula editor/ SQL Expression)
Please, if any1 can help me outhai,
Use Running Total fields, give the conditions in the Running Total Field Formulas. hope this will works you better. let me know the status.
regards,
Bhuvana
Friday, March 9, 2012
Problem listing data
Please tell me what I am doing wrong. I have some problems using Crystal Reports. I have for an example an Access database with a table called "Authors". I connect to the database using the server explorer in VS.NET 2005, I create an OleDbConnection and a DataAdapter. I use the Generate Dataset option from the DataAdapter to generate a Typed DataSet called dataSet1. I load data into the DataSet using the Fill method from the DataAdapter. Then I insert a new Crystal Report Document Using the Wizard and I add as data source From the Project Data/ADO.Net Datasets the dataset1.Authors. I add all the fields from the dataset and I add an Crystal Report Viewer control to the main form. I use the folowing code to set the ReportSource filed of the viewer:
CrystalReport1 cs = new CrystalReport1();
this.crystalReportViewer1.ReportSource = cs;
Ok, when I run the Application the Crystal Report Viewer it lists nothing from the DataSet data. What is wrong?I found a solution by adding a magic line of code:
CrystalReport1 cs = new CrystalReport1();
cs.SetDataSource(this.dataSet11);//here it is!
this.crystalReportViewer1.ReportSource = cs;
CrystalReport1 cs = new CrystalReport1();
this.crystalReportViewer1.ReportSource = cs;
Ok, when I run the Application the Crystal Report Viewer it lists nothing from the DataSet data. What is wrong?I found a solution by adding a magic line of code:
CrystalReport1 cs = new CrystalReport1();
cs.SetDataSource(this.dataSet11);//here it is!
this.crystalReportViewer1.ReportSource = cs;
Monday, February 20, 2012
Problem in web reporting
Hi,
Using CR9 and ASP to publish the reports in web. Using the sample code given by the crystal decisions.com. How many sessions/users it will support at a time?
Sometimes, my reports are too to slow
Have idea, pls help me
ThanksDear friend,
It's not a reply to ur question that you put long back...But I'm facing the same problem today...Actually I'm new in ASP...I'm trying to get a report from the data of my table...I just could not get any idea...If you got will you help with the part of coding...I mean how you connected to CR from ASP and got report...I'm using ASP in Visual Interdev and SQL server 2000 as backend
Using CR9 and ASP to publish the reports in web. Using the sample code given by the crystal decisions.com. How many sessions/users it will support at a time?
Sometimes, my reports are too to slow
Have idea, pls help me
ThanksDear friend,
It's not a reply to ur question that you put long back...But I'm facing the same problem today...Actually I'm new in ASP...I'm trying to get a report from the data of my table...I just could not get any idea...If you got will you help with the part of coding...I mean how you connected to CR from ASP and got report...I'm using ASP in Visual Interdev and SQL server 2000 as backend
Subscribe to:
Posts (Atom)