PDA

View Full Version : VB .NET making blood pressure rise dangerously...


ice1000
05-01-2006, 06:32 PM
One web form. One sqlconnection, one datagrid.

sql connection string: Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files\Microsoft SQL Server\MSSQL\Data\northwnd.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True

Configuration works great. Tests fine.

Data grid has the sqlconnection as a datasourceid. When running I get the error:

An attempt to attach an auto-named database for file C:\Program Files\Microsoft SQL Server\MSSQL\Data\northwnd.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

Potential solution of deleting folder in SQLExpress folder is no good. Only one folder there.

calm down...calm down...
:mad:

Athena
05-01-2006, 06:40 PM
Is there a reason you're specifying the file name? I've never tried that, but from the error you post, it sounds as if it's trying to create a new DB using that file, which already exists.

Try doing something like:

Data Source=SQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True;Connect Timeout=30;User Instance=True

ice1000
05-01-2006, 08:12 PM
I think I added a sql database object instead of a connection object but I royally screwed up my sql server trying to find out what was wrong. have to reinstall.