469,311 Members | 2,514 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,311 developers. It's quick & easy.

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 7581
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

Post your reply

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

Similar topics

reply views Thread by Tom | last post: by
1 post views Thread by raf_z | last post: by
reply views Thread by lewindha | last post: by
3 posts views Thread by Dan Aldean | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.