TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alexg
NA
1
0
Crystal Report DB connection from code
Dec 6 2004 4:57 PM
Dear colleagues, I’m writing C# app working with access 200 db. It is supposed to use DSNless ODBC connection string to avoid setting ODBC connection in control panel on every client PC. I have to use Crystal Report as my reporting tool. My problem is to connect reports to db from the code. When the next code is executed, it brings me Database Login screen and says “LogOn failed” every time I click Ok. Code: ReportDocument ReportDoc = new ReportDocument(); ReportDoc.Load(“c:\report.rpt”); try { TableLogOnInfo logOnInfo = new TableLogOnInfo (); int i = 0; // Loop through every table in the report. for (i=0;i < ReportDoc.Database.Tables.Count;i++) { logOnInfo.ConnectionInfo.ServerName = ""; logOnInfo.ConnectionInfo.UserID = "admin"; logOnInfo.ConnectionInfo.Password = ""; logOnInfo.ConnectionInfo.DatabaseName = “c:\database.mdb”; ReportDoc.Database.Tables [i].ApplyLogOnInfo (logOnInfo); } return true; } catch (Exception ex) { return false; } crystalReportViewer1.ReportSource = ReportDoc; Thanks in advance
Reply
Answers (
0
)
How to subtract a date to another date?
finally block in exception handling