Click here to Skip to main content
15,916,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello There,

I have created a project in C#, Hospital Management System,

In this project to display patient information from MS Access database I have used Crystal Report "CrystalReport.rpt", to this report I have declared database location in Design View by creating Connection String.

Now my problem is as this connection string is created in design view I have to give the exact location of my "Hospital_Management_System.mdb" file like "C:\Firdaus\Hospital Management System\App_Data\Hospital_Management_System.mdb", whenever I change location of my project I have to change connection string also, this is OK with code, but When I have created setup file I can't do the same after installing it.

I have added this file in App_Data folder and given path as
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\\Hospital_Management_System.mdb"); for entire project except in connection string of crystalreport.rpt as this is not possible!

It works properly even after changing location as expected...


What can I do with connection string for crystal report?


Thanks in Advance,
Firdaus Shaikh
Posted
Comments
Firdaus Shaikh 23-Jun-11 14:04pm    
73 viewing and not a single comment!
is my question unclear or there is no way for doing what I wanted to do, in crystal report!

1 solution

You will find the required information by searching for TableLogOnInfo(s) and ConnectionInfo. These structures will help with setting the database parameters dynamically for a Crystal Report.
 
Share this answer
 
Comments
Firdaus Shaikh 25-Aug-11 7:07am    
Sorry for late reply, I just lost hope for solution , well thanks for your help, Let me try,
Thanks again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900