473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Passing Parameters using CRYSTAL REPORTS

51
hey all,

I am passing parameters through code to a stored procedure in both windows application (using c# and sql server & crystal reports)and web application(using asp.net & sql server & crystal reports)...
the windows application works perfectly..
bt web apllication gives exception..."Invalid Table Number"...

Can nebdy help...Please......
Jan 12 '07 #1
6 7779
radcaesar
759 Expert 512MB
Send the code and exception u got in detail

:)
Jan 12 '07 #2
Smish
51
thanx sir.....
i am giving u the code as well as exception........



this same appliction runs perfectly in windows...application

when i do this like this i get logon exception failed. in web application..

in page_load am writing this code..................

{
CrystalReport1 rptReportClass = new CrystalReport1();
rptReportClass.SetDatabaseLogon("sa","");
CrystalReportViewer1.ReportSource = rptReportClass;


//am taking value from another web page....

if(Request.QueryString["Name"]!=null )
text1 = Request.QueryString["Name"];

discreteVal.Value = text1;
paramField.ParameterFieldName = "vDepartment";
paramField.CurrentValues.Add(discreteVal);
rptReportClass.DataDefinition.ParameterFields["@vDepartment"].ApplyCurrentValues(paramField.CurrentValues);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;

}


so i get exception...

(

Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


)

so i added this snip of code in the above instead of rptReportClass.SetDatabaseLogon("sa","");



(

CrystalDecisions.Shared.ConnectionInfo conn=new ConnectionInfo();
CrystalDecisions.CrystalReports.Engine.Table myTable;
CrystalDecisions.Shared.TableLogOnInfo myLog;
conn.ServerName="VENUS";
conn.DatabaseName="master";
conn.UserID ="sa";
conn.Password="";
for(int i=0;i<rptReportClass.Database.Tables.Count;i++)
{

myTable=rptReportClass.Database.Tables[i];
myLog = myTable.LogOnInfo;
myLog.ConnectionInfo= conn;
myTable.ApplyLogOnInfo(myLog);
myTable.Location= myLog.TableName;
}




)



bt then i get this error...

Error in File C:\WINDOWS\TEMP\temp_3a9b8810-741f-4b4f-92a7-ae4cd51a5fe0.rpt: Invalid table number.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.InvalidArgu mentException: Error in File C:\WINDOWS\TEMP\temp_3a9b8810-741f-4b4f-92a7-ae4cd51a5fe0.rpt: Invalid table number.


hope ill get solution for this.............
Jan 15 '07 #3
kenobewan
4,871 Expert 4TB
Here is an article that may help, C# e.g. half way down:
How to pass Database logon info to a Crystal Report at runtime in VB.NET
Jan 16 '07 #4
Dear sir,
I want to pass two parameters for date from and date to to the crystal report so that the output is according to it.
Can u plz guide me in this.
[email removed]

Thanks and Regards
Prabodh Bansal
Feb 15 '07 #5
Hi Smish,

The error indicates that you have authenication problems with the web version of your database. Are you sure you have the same credentials set for your windows and web databases?
The 2nd error indicates that a parameter type does not match what Crystal is expecting to match against the database data type. In other words, check that the code in your web version that passes the parameter has set the same data type as the field in the data table residing in your web database.

Now, if you are using the SAME database for both Windows and Web apps you have a different set of problems. If this is the case, then obviously the problem does not reside with different authentication models or data types. The difference must be in your code. Check that the web code matches your windows code (in terms of functionality, obviously syntax will vary).

Good luck.

Cheers,
Mark Chimes



thanx sir.....
i am giving u the code as well as exception........



this same appliction runs perfectly in windows...application

when i do this like this i get logon exception failed. in web application..

in page_load am writing this code..................

{
CrystalReport1 rptReportClass = new CrystalReport1();
rptReportClass.SetDatabaseLogon("sa","");
CrystalReportViewer1.ReportSource = rptReportClass;


//am taking value from another web page....

if(Request.QueryString["Name"]!=null )
text1 = Request.QueryString["Name"];

discreteVal.Value = text1;
paramField.ParameterFieldName = "vDepartment";
paramField.CurrentValues.Add(discreteVal);
rptReportClass.DataDefinition.ParameterFields["@vDepartment"].ApplyCurrentValues(paramField.CurrentValues);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;

}


so i get exception...

(

Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


)

so i added this snip of code in the above instead of rptReportClass.SetDatabaseLogon("sa","");



(

CrystalDecisions.Shared.ConnectionInfo conn=new ConnectionInfo();
CrystalDecisions.CrystalReports.Engine.Table myTable;
CrystalDecisions.Shared.TableLogOnInfo myLog;
conn.ServerName="VENUS";
conn.DatabaseName="master";
conn.UserID ="sa";
conn.Password="";
for(int i=0;i<rptReportClass.Database.Tables.Count;i++)
{

myTable=rptReportClass.Database.Tables[i];
myLog = myTable.LogOnInfo;
myLog.ConnectionInfo= conn;
myTable.ApplyLogOnInfo(myLog);
myTable.Location= myLog.TableName;
}




)



bt then i get this error...

Error in File C:\WINDOWS\TEMP\temp_3a9b8810-741f-4b4f-92a7-ae4cd51a5fe0.rpt: Invalid table number.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.InvalidArgu mentException: Error in File C:\WINDOWS\TEMP\temp_3a9b8810-741f-4b4f-92a7-ae4cd51a5fe0.rpt: Invalid table number.


hope ill get solution for this.............
Mar 1 '07 #6
Smish
51
hi,
Thanx ..itz solved..

Hi Smish,

The error indicates that you have authenication problems with the web version of your database. Are you sure you have the same credentials set for your windows and web databases?
The 2nd error indicates that a parameter type does not match what Crystal is expecting to match against the database data type. In other words, check that the code in your web version that passes the parameter has set the same data type as the field in the data table residing in your web database.

Now, if you are using the SAME database for both Windows and Web apps you have a different set of problems. If this is the case, then obviously the problem does not reside with different authentication models or data types. The difference must be in your code. Check that the web code matches your windows code (in terms of functionality, obviously syntax will vary).

Good luck.

Cheers,
Mark Chimes
Mar 2 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Aaron | last post by:
The following code works fine when previewing a Crystal report using ASP, EXCEPT when it gets to a report using a SubReport and its associated parameters. The whole report just comes up blank with...
0
by: Tom | last post by:
We have a .NET C# web-based application using Crystal Reports 9 to display reports. One of these reports has a dozen or so parameters. I would like to avoid having to build some custom parameter...
1
by: Maria | last post by:
Hello! I am new to Crystal reports an I have problems passing parameters form outside to Crystal report an creating a report with data from more than one table This is the problem: I have to...
0
by: stephan | last post by:
I know that this has been beaten to death but I can't seem to resolve my issues (I have 2 of them). I have created a class that exposes a public method which returns a datatable as a datasource...
1
by: raf_z | last post by:
Hi, I'm running a website with Asp.NET, and on one of the pages i have a crystal report with 3 user-populated parameters. However, not all params might be selected. Example: Parameters: 1....
0
by: lewindha | last post by:
Hi all I am new to ASP.Net and Crystal Reports. We have VS.Net 2003 and Crystal 10 where I work. I have successfully been able to view reports in a web page. My problem now is that I have a...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
0
by: ZRexRider | last post by:
Hi, I've written reports based on stored procedures that receive parameters and it usually seems straight forward. Today I would like to use Crystal Reports parameter interface t prompt for a...
3
by: Dan Aldean | last post by:
Hi, To create a Crystal Reports I use a ReportViewer. How can I pass parameters to the report which is based on a stored procedure. Please provide some code. Thanks
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.