Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File DSN in crystal reports

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
Can anyone provide me the code in vb.net to connect crystal reports using FILE DSN?
 

1) In Windows create the File DSN.

2) In VB .NET create a new Crystal Report.

3) In the Standard Report Creation Wizard, select "Create New Connection->ODBC (RDO)->Make New Connection" as the data source for the report.

4) In the ODBC (RDO) dialog, select the radio button for "Find File DSN". In the file open dialog browse to the location of the file DSN created in step 1. Select it and click the "Open" button.

5) In the ODBC (RDO) dialog, click the "Next" button.

6) In the next screen of the dialog, enter the user name and password (if any) to access the database.

7) Click "Finish".

The File DSN should now appear in the "ODBC (RDO)" section, and also in the "Current Connections" section.

Like I said in the other thread, the File DSN is just a text file. If you ever change the path of the database or other connection information, just edit the File DSN and that's it.

Here's an example of a File DSN:

Code:
[ODBC]
DRIVER=Microsoft Access Driver (*.mdb, *.accdb)
UID=admin
UserCommitSync=Yes
Threads=3
SafeTransactions=0
PageTimeout=5
MaxScanRows=8
MaxBufferSize=2048
FIL=MS Access
DriverId=25
DefaultDir=C:\Some\path
DBQ=C:\Some\path\someDB.mdb

You can just create this text file in the DataSources directory - typically C:\Program Files\Common Files\ODBC\Data Sources on WinXP. There is no registration or anything required. Create one in the ODBC Data Source Administrator for your database and use that as a template to recreate it on the target machines.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Thank you so much for the reply. Is system dSN better or File Dsn is better to use?
 
I have one more doubt, what is the code in vb.net to give the connection details to connect to crystal reports?
 
Sorry in the server name i gave it as "Name.dsn" it worked perfectly. Is it the correct way to do?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top