# VB .NET making blood pressure rise dangerously...

**URL:** https://boards.straightdope.com/t/vb-net-making-blood-pressure-rise-dangerously/355010
**Category:** Factual Questions
**Created:** [May 1, 2006, 10:32pm UTC](https://boards.straightdope.com/t/vb-net-making-blood-pressure-rise-dangerously/355010 "2006-05-01T22:32:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ice1000](https://avatars.discourse-cdn.com/v4/letter/i/a3d4f5/32.png) [@ice1000](https://boards.straightdope.com/u/ice1000)
#### Post date: [May 1, 2006, 10:32pm UTC](https://boards.straightdope.com/t/vb-net-making-blood-pressure-rise-dangerously/355010/1 "2006-05-01T22:32:44Z")

</div>

One web form. One sqlconnection, one datagrid.

sql connection string: Data Source=.\SQLEXPRESS;AttachDbFilename=“C:\Program Files\Microsoft SQL Server\MSSQL\Data  
orthwnd.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  
orthwnd.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:

---

<div class="post-metadata">

### Author: ![Athena](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@Athena](https://boards.straightdope.com/u/Athena)
#### Post date: [May 1, 2006, 10:40pm UTC](https://boards.straightdope.com/t/vb-net-making-blood-pressure-rise-dangerously/355010/2 "2006-05-01T22:40:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ice1000](https://avatars.discourse-cdn.com/v4/letter/i/a3d4f5/32.png) [@ice1000](https://boards.straightdope.com/u/ice1000)
#### Post date: [May 2, 2006, 12:12am UTC](https://boards.straightdope.com/t/vb-net-making-blood-pressure-rise-dangerously/355010/3 "2006-05-02T00:12:06Z")

</div>

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.
