|
Everything seems fine, but i'm wondring why i get an empty display of the "@vDepartment" parameter in the actual report.
thank you.
xxx
|
|
|
|
|
Dear Pankaj,
Code really works fine.Thanks a ton.But i have a small doubt why do we need to reconstruct the paramfield as well as paramDiscreteValue.I am unable to understand. I dont have much idea in oops concept kindly explain me in detail.Is there any other way to pass the parameters to the reports..Let us say iam using 5 different paramters so do i need to declare and instantiate 5 time or what.
|
|
|
|
|
Want to Accespt Parameters with Comma Seperated values.
I want dynamic report in which user selects values using check boxes. I pass them to procedure which is bound to Crystal Report, but the issue is crystal does not show any dynamic data that procedure returns.
My query is working fine with comma seperates values
(Used in statement while selecting: eg.: select a from b where c in (1,2,3))
While passing these values to Crystal, it is not showing any record while procedure shows all.
If i change the procedure to accept single value as parameter, pass single value to RPT, i get the results.
I need to know is there a way to pass comma seperated values to crystal report in a single parameter?
If Anybody has done it? Any help appreciated.
DevIndia
|
|
|
|
|
|
hi
i use these codes for reporting
my proc:
<pre>create proc Cpost
@nopersoneli int
As
Select p.fname,p.lname,p.NoPersoneli,po.name from personal p
Join postpersonal pp
On p.NoPersoneli=pp.Cpersonal
Join post po
On po.code=pp.vpost
</pre>
<pre> ReportDocument reportDocument = new ReportDocument();
ParameterField paramField = new ParameterField();
ParameterFields paramFields = new ParameterFields();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
paramField.Name = "@NoPersoneli";
paramDiscreteValue.Value = "45";
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
crystalReportViewer1.ParameterFieldInfo = paramFields;
reportDocument.Load(@"C:\Documents and Settings\Administrator\Desktop\VEZARAT\VEZARAT\PostCrystalReport.rpt");
reportDocument.SetDatabaseLogon("", "", "niloofar\\i2", "vezaratekar", false);
crystalReportViewer1.ReportSource = reportDocument;
</pre>
error:The parameter is incorrect
please help to me
thanks a lot
|
|
|
|
|
Check whether u had added the parameters in the CrystalReport - FieldExplorer in ParameterFields
|
|
|
|
|
hello,at first,thanks for your usefull article
i have one qustion,if i want to write this program with sqldataadaptor and dataset and sqlconnection,is it possible?please guide me.
i wrote that,but i have a an error,"invalid report path',i wonder if you could help me.an my codes:
Private Sub btnPreview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPreview.Click
Try
Dim cmd As New SqlClient.SqlCommand("Sel_SalesData", connection)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@vDepartment", "South")
cmd.Parameters.AddWithValue("@iSalesYear", "2004")
If connection.State = ConnectionState.Closed Then
connection.Open()
End If
Dim adapter1 As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd)
adapter1.Fill(dst)
Dim rep As New ReportDocument()
rep.SetDataSource(dst)
CrystalReportViewer1.ReportSource = rep
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
sepideh
|
|
|
|
|
Thanks a lot for posting this (the crystal parameter one), saves a lot of time on my release date!!
adfg
|
|
|
|
|
Thanks and you are welcome
Pankaj A. Chitriv
|
|
|
|
|
CrystalDecisions.CrystalReport.Engine.ParameterFie ldCurrentValueException:
Missing parameter values.
This is the error that I get when the report is subjected to print.
Could you help me solve this?
Ansaf
|
|
|
|
|
Dear Pankaj A. Chitriv,
I look your example and have next question:
I have a report file.rpt and datasource is view (database in SQL Server).
I make a web page and put control crystalreportviewer and crystalreportsource.
In other web page have a gridview and button Report, I need to click button active crystalreport(file.rpt) and pass parameter where currentrowindex is posicionate in gridview.
How make this?
Can you help me please?
Thanks for your help,
Regards.
|
|
|
|
|
I have read your article, first thank you for you time. My questions is pretty straight forward, in your example you know all the stored procedures to call at design time, do you know of a way to get the name of the stored procedures at design time for the Crystal Parameters?
|
|
|
|
|
Hi,
I am working with asp.net 1.1(C#) and i want to show report using Crystal Report 9.0.I have written code to fill ado.net dataset and assign that dataset to crystalreport but it is giving error "LOGON FAILED".
Why this error is coming?
how can i resolve it.
Please Help..............
Thanks
Pramod
|
|
|
|
|
Can you try by giving enableUseridpassword for the crystalreportviewer false and try
|
|
|
|
|
How do we pass sql command parameter to Crystal Report?
For Example: Select * From TABLE Where VALUE = 5
Crystal Report must show the result of this query. Please help me. Thanks.
|
|
|
|
|
Hi!
You should see CrystalReport's RecordSelectionFormula property. You can set Primary key of the table according to you requirement like:
rpt.RecordSelectionFormula = "{YourTable.PrimaryKeyfieldName}=" & Val(TxtCode.Text)
Here:
txtcode.text will contain the value of the PrimaryKeyfieldName of the table.
Hope it helps!
|
|
|
|
|
I want to know if this code works for Oracle with the stored procedure? If not can someone give an example?
Also in your code: The stored procedure input parameters are: @vDepartment and @iSalesYear. I can see you setting the values for those parameters. But where are you setting the stored procedure name 'Sel_SalesData' and associating it to the report.
Can you please explain - Because I may have several stored procedures, how does the report know which stored procedure to call?
vhrao
-- modified at 18:07 Thursday 12th October, 2006
|
|
|
|
|
Thanks Pankaj,
Works great in VS 2005!!!! No Problems what-so-ever. Didn't have to change anything except Datasource location and DB logon (of course).
Don't let the negative posts keep you from adding more articles if so inclined. I wonder if the negative Nancy's are having trouble setting up the SQL Server end of it.
Thanks again for the effort.
|
|
|
|
|
VS 2003 + SQL2000
public virtual new void SetDatabaseLogon ( System.String user , System.String password , System.String server , System.String database )
CrystalDecisions.CrystalReports.Engine.ReportDocument
public virtual new void SetDatabaseLogon ( System.String user , System.String password )
CrystalDecisions.CrystalReports.Engine.ReportDocument
not the fifthly parameter??????????
ice.boat
mail:b_zhou_cn@yahoo.com
|
|
|
|
|
Hi, there,
I'm getting a problem when generating crystal report in .net.
There is always a popup window called " Database login", asking input for ServerName, Database, LoginId and password. And whatever login id and password I've enterred, It gives me the error message "Logon Failed. Please try again."
I've checked the SQL Server Enterprise Manager, the permission of the table I'm accessing has been setted up to public access. It doesn't seem like the problem.
So, any advice?
Thanks in advance.
|
|
|
|
|
Hi
I am developing a windows application in C#. I have a problem while using MS Sql Stored procesures in Crystal reports. If there are only select statements in procedure, it works fine. But if there is any insert statements in the stored procedure( of cource, the last statement I provided is a select statement to get the rows in report), no fields are listed while trying to create a report with the same. So I am unable to desingn the report with those procedures.
If anyone can give a solution, it will be a greate help for me.
Thanks
Gireesh Viswanathan
-- modified at 8:54 Tuesday 18th October, 2005
|
|
|
|
|
Gireesh
I am having the same problem. Did you ever resolve it?
I can't believe that stored procedures with INSERT cannot be used .NET.
Thanks.
Barry Walter
|
|
|
|
|
Recently I saw a documentation about this.
It says that you can get results from only your first query.
|
|
|
|
|
I'm trying to build an application in C# to export reports in HTML format and other...
But they are no possibilities for me to change the database location into the RPT file. I'm trying but still no result.
I've put the source code to change the database location what I used, help me please, I'm so tired to try and get damn errors who have no sense!
sc:
__________________________________________________________________________________________________________________________________
ReportDocument MyReport = new ReportDocument();
MyReport.Load(rpt_src);
MyReport.SetDatabaseLogon("user", "userpwd", "DSN", "DBName", false);
crystalReportViewer1.ReportSource = MyReport;
__________________________________________________________________________________________________________________________________
After that, the login box is shown to put the db's connection infos! Why?
I've tryed another methode to change the connection infos :
__________________________________________________________________________________________________________________________________
ReportDocument MyReport = new ReportDocument();
MyReport.Load(rpt_src);
for (int i = 0; i <= (MyReport.Database.Tables.Count)-1; i++)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo();
logOnInfo = MyReport.Database.Tables[i].LogOnInfo;
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo = logOnInfo.ConnectionInfo;
connectionInfo.DatabaseName = database;
connectionInfo.ServerName = server;
connectionInfo.Password = password;
connectionInfo.UserID = user;
connectionInfo.AllowCustomConnection = true;
MyReport.Database.Tables[i].ApplyLogOnInfo(logOnInfo);
}
crystalReportViewer1.ReportSource = MyReport;
__________________________________________________________________________________________________________________________________
But nothing is better...
I don't understand what is the damn logic with CR ...
|
|
|
|
|
http://msdn.microsoft.com/msdnmag/issues/02/05/Crystal/
This article was particularly helpful to me. It even had some useful information on how to get the Procs available as a datasource and a bug in the Crystal Services under IIS. It explains parameters a bit, even admiting that they are somewhat convoluted.
Hope it helps.
|
|
|
|