0
votes

I am storing my database in the APP_DATA Folder of my application.

I added crystal report to my application. I mentioned .\SQLEXPRESS as my server.

In database drop down i see only these databases -Master, Model, msdb, tempdb

My dabase's name is "Database.mdf" . Why i am not able to see it ?

My connection string is : Data Source=.\SQLEXPRESS ;AttachDbFilenam e=C:\Inetpub\ wwwroot\test\ App_Data\ Database. mdf;Integrated Security=True; User Instance=True I am using localhost. VS 2005 .NET 2.0

1

1 Answers

0
votes

This is kind of an older post (in SO terms), but I figured I'd comment anyway with some things you can try.

First is that you don't have to include AttachDBFilename in your config connection string when connecting to the SQL Server database. If the database is attached to the local SQLEXPRESS instance then you should be able to reference it that way. You should include "initial catalog=[your database name]" in the connection string so it knows which database to look at.

Also instead of putting the absolute path of the filename, if you are going to connect by filename, I believe that you can put "|DataDirectory|" which refers to the App_Data folder. So that part would instead look like "AttachDbFilename=|DataDirectory|\Datbase.mdf".

I'm sure you've gotten the issue figured out by now, but if not then I hope this helps.