A question about accessing an SQL Server db

A

Anthony P.

Hi Folks,

First, thank you guys for being so patient with me as I ask so many
questions during the development of this application. I have yet
another question. This time, about accessing an SQL Server dbs and
first chance exceptions. So, here goes...

I am wanting to access an SQL Server db. So, in my declaration
section, I have the following:

Imports System.Data
Imports System.Data.SqlClient

When I try to build the project and before any other code I wrote is
run, the system is kicking out three first chance exceptions on these
lines. They all say the same thing:

"A first chance exception of type 'System.Data.SqlClient.SqlException'
occurred in System.Data.dll"

I know what first chance exceptions are and I would not have a problem
if they were thrown against my code. But this seems to be thrown
agains the Imports statements? I can't really catch these exceptions
(I'd rather eliminate them anyway) so I am at a loss as to what to do.

Can anyone clue me in?

Thanks!
Anthony
 
A

Anthony P.

So it looks like I solved this. It was all because of a bad connection
string. Took me 4 hours, lots of Google searches, and enough bad
language to make a sailor blush. But damnit I solved it!

The final connection string that worked was:

Dim sConnectionString As String = "Data Source=.
\SQLEXPRESS;AttachDbFilename='C:\Program Files\Microsoft SQL Server
\MSSQL.1\MSSQL\Data\pemr.MDF';Integrated Security=True;Connect
Timeout=30;User Instance=True"

God DAMN that was rough!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top