1

Is it possible to connect to a database in the App_Data project folder using the command line? I'm trying to test some SQL statements outside of the VS environment.

I tried using the below, but that didn't seem to work:

sqlcmd -S .\Sqlexpress -d [location of mdf]
locoboy
  • 38,002
  • 70
  • 184
  • 260

1 Answers1

0

Not sure about the app_data folder, but if you have the db files running off of a sql install, you can use sqlcmd command line which is installed with the sql client tools or the sql feature pack (sql native client).

Sam
  • 7,543
  • 7
  • 48
  • 62
  • yeah i tried to using sqlcmd -S .\SQLEXPRESS -d [location of mdf] but that didn't seem to work – locoboy Mar 30 '11 at 19:43
  • And when you connect to your sql express install with management studio, do you see that database? I've never heard of an .mdf running outside of a sql server except the compact edition. http://stackoverflow.com/questions/528858/what-is-the-app-data-folder-used-for-in-visual-studio – Sam Mar 30 '11 at 19:46
  • So if it's not in .\SQLEXPRESS , you need to attach the file through management studio or commands in sqlcmd. – Sam Mar 30 '11 at 19:46
  • 1
    http://forums.asp.net/t/1007468.aspx/1?Howto+use+MSSQL+2005+Express+database+mdf+in+app_data+folder+ - From that, I would say that VS is acting as the DB server and you will not be able to interact unless you attach to a proper sql server. – Sam Mar 30 '11 at 19:48
  • I don't have management studio. Is it necessary? Also, if the connection string says that my datasource is ./SqlExpress then why can't I connect to it via command line. sorry for the confusion. – locoboy Mar 30 '11 at 20:10