set database path for crystal report

albertkhor

Well-known member
Joined
Jan 12, 2006
Messages
150
Programming Experience
Beginner
how to set the database path by coding, so that even i change my system folder location the crystal report still can run without asking user to set the database path location when run time.
 
look, since I remember I always tied it (utilise CR) with ODBC connection. Then if you move or install the app on target PC all you need is a new ODBC (DSN) connection with the same name.
Control Panel -> Administrative Tools -> Data Sources (ODBC) -> Add button and then just follow the "create new data source" dialog.

HTH
Regards ;)
 
kulrom said:
look, since I remember I always tied it (utilise CR) with ODBC connection. Then if you move or install the app on target PC all you need is a new ODBC (DSN) connection with the same name.
Control Panel -> Administrative Tools -> Data Sources (ODBC) -> Add button and then just follow the "create new data source" dialog.

HTH
Regards ;)

kulrom you again, thx a lot you really help me a alot!:D i just learn .net compact framework since last year oct.

my system may use for other pc as well and i dun know where there will install. so if i use your way, i need to set all the pc one by one. The database will only save on one location which is same folder with the system itself. (i can use
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase to get my system folder) So how to set the Database source for crystal report?
 
Hi Albert,
You can go for configuration file too (without ODBC) ... but, again you will have to change/set up the path after you install the app . However, if certain DB is stored on server machine you have to set all the PC's one by one ... unless you can predict the location and include it in config file while development.
Also notice that you can create a new ODBC conn programatically just you have to know as i said the exact location of DB indeed. Well, maybe you can make a wizard which creates ODBC conn giving the location of DB in some of steps.
However i found that CR works better with ODBC conn than any other alternatives. I guess you know about dataset and stuff but it is kinda tricky and more complexed than using of ODBC.


Regards ;)
 
kulrom said:
Hi Albert,
You can go for configuration file too (without ODBC) ... but, again you will have to change/set up the path after you install the app . However, if certain DB is stored on server machine you have to set all the PC's one by one ... unless you can predict the location and include it in config file while development.
Also notice that you can create a new ODBC conn programatically just you have to know as i said the exact location of DB indeed. Well, maybe you can make a wizard which creates ODBC conn giving the location of DB in some of steps.
However i found that CR works better with ODBC conn than any other alternatives. I guess you know about dataset and stuff but it is kinda tricky and more complexed than using of ODBC.


Regards ;)

that's what i want to know, how to create a new ODBC conn or OLEDB conn programatically? now i'm using microsoft jet 4.0 OLEDB provider to connect my DB (.mdb).

u mean i can set all my data to dataset and bind to crystal report? i also want to do that, but dataset can store picture or not because my database need to store picture file. And the only thing i cannot understand is how to make the crystal report work. Like what i do now is from crystal report i add the database table and drag the field to crystal report but if i use dataset how to insert the data? (hope you can understand what i trying to explain)

can you provide me an example system? If no is ok just tell me the way to do that.
 
Back
Top