Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Cannot find crystal reposts in my crystal report.I have tried alot to find a repost but cannot find database or even database file to database expert.
Posted

1 solution

Attach the MDF file to SQLExpress

SQLCMD -S.\SQLEXPRESS -e
1> sp_attach_db @dbname = 'MyDB', @filename1 = N'C:\Documents and Settings\dtorg\My Documents\MyDB.mdf'
2>go

2) Create a FileDSN and select the 'MyDB' database
Administrative Tools->Data Sources (ODBC)
Select File DSN
Create a new file 'MyDB.dsn
Server: .\SQLExpress
Default database: 'MyDB'
Save the file :MyDB.dsn

3) Create a new report.
Select ODBC (RDO)
Select FindFileDNS: browse to MyDB.dsn
Select finish and you can then select your tables.

Alternate:
Select OLE DB (ADO)
Select SQL Native Client
Select server .\SQLEXPRESS
Select Integrated security
Select database 'MyDB'
Select finish and you can then select your tables.

I would rather use the following connect string to connect to the database. It eliminates the need to perform the sp_attach_db above.

Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\dtorg\My Documents\MyDB.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True
 
Share this answer
 
Comments
Hitul Mistry 2-May-12 15:13pm    
It shows me systax error in 1> when i execute go command.

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