|
-
May 28th, 2003, 02:31 AM
#1
Crystal Report ERROR
Hi
I created a ".csv" file with help of query analyzer . I kept that file in "c:\" , now i created a "crystal report using " asp.net with c# . I went to "report expert " and added the columns in the ".csv" , in the code behind file i created a oledbconnection to the ".csv" ,wrote a "select * from the aa.csv" and got the values in the dataset and then i did the following
crystalreport1.setdatasource =ds;
crystalreportviewer1.reportsource=crystalreport1;
on running the solution i get the following error
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.LogOnException: Logon failed.
code:
oConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\xtreme.mdb;");
OAdapt = new OleDbDataAdapter("select * from Supplier",oConn);
DataSet ds = new DataSet();
OAdapt.Fill(ds);
oRpt.SetDataSource(ds);
CrystalReportViewer1.ReportSource =oRpt;
I need ur help ...
-
May 31st, 2003, 08:07 AM
#2
hi srikri
the connection u have created is used only to connect Dataset and get data
u will have to also connect crystal report object to Database or mdb file in ur case
the following is the code to connect Sql Server just change the required fields to connect to MDB file.
public ReportDocument oRpt=new ReportDocument();
CrystalDecisions.Shared.TableLogOnInfo crLogonInfo;
crLogonInfo = oRpt.Database.Tables[0].LogOnInfo;
crLogonInfo.ConnectionInfo.ServerName = ["Server"];
crLogonInfo.ConnectionInfo.UserID =["dbUser"];
crLogonInfo.ConnectionInfo.Password =["dbPwd"];
crLogonInfo.ConnectionInfo.DatabaseName =["dbName"];
oRpt.Database.Tables[0].ApplyLogOnInfo(crLogonInfo);
and every time u perform any operation (like navigating between pages) on crystal report, u will have to provide logon parameters in page load
Rohit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|