Error when connecting to SQLExpress

E

Earl

I have an issue that is totally baffling me. When I use a program I've
written to connect to SQLExpress (and a given database), all works well on
my development system and on a laptop that I tested with. However, I have
two users that I sent the SAME database files and program files to and at
the moment the program tries to connect to the server/database, they get the
generic Windows error message "[Your Program] has encountered an error and
needs to close. We are sorry for the inconvenience."

This differs from handled exceptions and unhandled exceptions within the
program. I have had the users uninstall their older SQLExpress and update to
the recent service pack, checked various configuration settings, including
owner of the database, including allowed remote connections, both TCP/IP and
NamedPipe. Everything "looks" correct, but no connection and the
above-mentioned Windows error message. I am just stumped, so I'd love to
hear any ideas or advice from anyone who has seen this before.
 
W

William \(Bill\) Vaughn

Let's hear a bit more about your configuration. I assume you're expecting an
existing SQL Express instance on the client system. Is it running? How are
the clients authenticated? I assume you have a Try/Catch around the Open.
Does the exception occur there? Is there a number with the error message?
Did you check the client systems event log? Let's see the ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
E

Earl

1. Yes, an existing SQL Express instance (I even tested it myself with
GotoMeeting, so I can see what they have)
2. It is running
3. Windows Authentication
4. Errors -- that is where the weirdness appears -- my error messages in the
Try/Catch do not show, I get the fancy generic Windows program error message
("We are sorry for the inconvenience..." the one where they want you to send
information to Microsoft).
5. I did not check the event log that is something I can review.
6. Connection string:

m_strConnection = "data source=" + m_strSQLServerName + ";" +
"initial catalog="+m_strDatabaseName+";integrated
security=SSPI;";

William (Bill) Vaughn said:
Let's hear a bit more about your configuration. I assume you're expecting
an existing SQL Express instance on the client system. Is it running? How
are the clients authenticated? I assume you have a Try/Catch around the
Open. Does the exception occur there? Is there a number with the error
message? Did you check the client systems event log? Let's see the
ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Earl said:
I have an issue that is totally baffling me. When I use a program I've
written to connect to SQLExpress (and a given database), all works well on
my development system and on a laptop that I tested with. However, I have
two users that I sent the SAME database files and program files to and at
the moment the program tries to connect to the server/database, they get
the generic Windows error message "[Your Program] has encountered an error
and needs to close. We are sorry for the inconvenience."

This differs from handled exceptions and unhandled exceptions within the
program. I have had the users uninstall their older SQLExpress and update
to the recent service pack, checked various configuration settings,
including owner of the database, including allowed remote connections,
both TCP/IP and NamedPipe. Everything "looks" correct, but no connection
and the above-mentioned Windows error message. I am just stumped, so I'd
love to hear any ideas or advice from anyone who has seen this before.
 
W

William \(Bill\) Vaughn

Assuming you're trapping the "Exception" (generic catch-all) exception...

Ok. By default, SQL Server Express does not expose itself on the network. In
addition, it's generally installed as a named instance--usually "SQLEXPRESS"
so the strSQLServerName must include the instance name as in
MySystem\SQLEXPRESS
to reference it. You also need to have rights on the specified database
unless the current user is in the Admin group. You aren't using the User
Instance option which has its benefits and issues.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Earl said:
1. Yes, an existing SQL Express instance (I even tested it myself with
GotoMeeting, so I can see what they have)
2. It is running
3. Windows Authentication
4. Errors -- that is where the weirdness appears -- my error messages in
the Try/Catch do not show, I get the fancy generic Windows program error
message ("We are sorry for the inconvenience..." the one where they want
you to send information to Microsoft).
5. I did not check the event log that is something I can review.
6. Connection string:

m_strConnection = "data source=" + m_strSQLServerName + ";" +
"initial catalog="+m_strDatabaseName+";integrated
security=SSPI;";

William (Bill) Vaughn said:
Let's hear a bit more about your configuration. I assume you're expecting
an existing SQL Express instance on the client system. Is it running? How
are the clients authenticated? I assume you have a Try/Catch around the
Open. Does the exception occur there? Is there a number with the error
message? Did you check the client systems event log? Let's see the
ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Earl said:
I have an issue that is totally baffling me. When I use a program I've
written to connect to SQLExpress (and a given database), all works well
on my development system and on a laptop that I tested with. However, I
have two users that I sent the SAME database files and program files to
and at the moment the program tries to connect to the server/database,
they get the generic Windows error message "[Your Program] has
encountered an error and needs to close. We are sorry for the
inconvenience."

This differs from handled exceptions and unhandled exceptions within the
program. I have had the users uninstall their older SQLExpress and
update to the recent service pack, checked various configuration
settings, including owner of the database, including allowed remote
connections, both TCP/IP and NamedPipe. Everything "looks" correct, but
no connection and the above-mentioned Windows error message. I am just
stumped, so I'd love to hear any ideas or advice from anyone who has
seen this before.
 
E

Earl

If anyone is still following this thread ... I've had the same response on 3
different systems now, one was a brand new install -- XP Pro, service pack
2, .Net 2.0 framework, SQLExpress2.0, and SSMSEE. I made no configuration
changes and accepted all defaults on the SQLExpress install, except for one:
I added the install user to the Administrator role.

Checked the event log after the crashes. The errors are showing as ".Net
Runtime 2.0 Errors". One error showed as "system.invalidoperationexception",
but all the others showed as "system.io.filenotfoundexception". Any
thoughts?


William (Bill) Vaughn said:
Assuming you're trapping the "Exception" (generic catch-all) exception...

Ok. By default, SQL Server Express does not expose itself on the network.
In addition, it's generally installed as a named instance--usually
"SQLEXPRESS" so the strSQLServerName must include the instance name as in
MySystem\SQLEXPRESS
to reference it. You also need to have rights on the specified database
unless the current user is in the Admin group. You aren't using the User
Instance option which has its benefits and issues.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Earl said:
1. Yes, an existing SQL Express instance (I even tested it myself with
GotoMeeting, so I can see what they have)
2. It is running
3. Windows Authentication
4. Errors -- that is where the weirdness appears -- my error messages in
the Try/Catch do not show, I get the fancy generic Windows program error
message ("We are sorry for the inconvenience..." the one where they want
you to send information to Microsoft).
5. I did not check the event log that is something I can review.
6. Connection string:

m_strConnection = "data source=" + m_strSQLServerName + ";" +
"initial catalog="+m_strDatabaseName+";integrated
security=SSPI;";

William (Bill) Vaughn said:
Let's hear a bit more about your configuration. I assume you're
expecting an existing SQL Express instance on the client system. Is it
running? How are the clients authenticated? I assume you have a
Try/Catch around the Open. Does the exception occur there? Is there a
number with the error message? Did you check the client systems event
log? Let's see the ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest
book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

I have an issue that is totally baffling me. When I use a program I've
written to connect to SQLExpress (and a given database), all works well
on my development system and on a laptop that I tested with. However, I
have two users that I sent the SAME database files and program files to
and at the moment the program tries to connect to the server/database,
they get the generic Windows error message "[Your Program] has
encountered an error and needs to close. We are sorry for the
inconvenience."

This differs from handled exceptions and unhandled exceptions within
the program. I have had the users uninstall their older SQLExpress and
update to the recent service pack, checked various configuration
settings, including owner of the database, including allowed remote
connections, both TCP/IP and NamedPipe. Everything "looks" correct, but
no connection and the above-mentioned Windows error message. I am just
stumped, so I'd love to hear any ideas or advice from anyone who has
seen this before.
 
R

Roger Wolter[MSFT]

The one thing that seems to stand out to me is that you have never mentioned
any error or message coming from SQL Express. A file not found error from
the .Net framework seems to be unrelated to the database. You seem
convinced that this is a database error but you haven't given any evidence
of this. Have you debugged through the application startup to see where the
exception is thrown?

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Earl said:
If anyone is still following this thread ... I've had the same response on
3 different systems now, one was a brand new install -- XP Pro, service
pack 2, .Net 2.0 framework, SQLExpress2.0, and SSMSEE. I made no
configuration changes and accepted all defaults on the SQLExpress install,
except for one: I added the install user to the Administrator role.

Checked the event log after the crashes. The errors are showing as ".Net
Runtime 2.0 Errors". One error showed as
"system.invalidoperationexception", but all the others showed as
"system.io.filenotfoundexception". Any thoughts?


William (Bill) Vaughn said:
Assuming you're trapping the "Exception" (generic catch-all) exception...

Ok. By default, SQL Server Express does not expose itself on the network.
In addition, it's generally installed as a named instance--usually
"SQLEXPRESS" so the strSQLServerName must include the instance name as in
MySystem\SQLEXPRESS
to reference it. You also need to have rights on the specified database
unless the current user is in the Admin group. You aren't using the User
Instance option which has its benefits and issues.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

Earl said:
1. Yes, an existing SQL Express instance (I even tested it myself with
GotoMeeting, so I can see what they have)
2. It is running
3. Windows Authentication
4. Errors -- that is where the weirdness appears -- my error messages in
the Try/Catch do not show, I get the fancy generic Windows program error
message ("We are sorry for the inconvenience..." the one where they want
you to send information to Microsoft).
5. I did not check the event log that is something I can review.
6. Connection string:

m_strConnection = "data source=" + m_strSQLServerName + ";" +
"initial catalog="+m_strDatabaseName+";integrated
security=SSPI;";

Let's hear a bit more about your configuration. I assume you're
expecting an existing SQL Express instance on the client system. Is it
running? How are the clients authenticated? I assume you have a
Try/Catch around the Open. Does the exception occur there? Is there a
number with the error message? Did you check the client systems event
log? Let's see the ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest
book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

I have an issue that is totally baffling me. When I use a program I've
written to connect to SQLExpress (and a given database), all works well
on my development system and on a laptop that I tested with. However, I
have two users that I sent the SAME database files and program files to
and at the moment the program tries to connect to the server/database,
they get the generic Windows error message "[Your Program] has
encountered an error and needs to close. We are sorry for the
inconvenience."

This differs from handled exceptions and unhandled exceptions within
the program. I have had the users uninstall their older SQLExpress and
update to the recent service pack, checked various configuration
settings, including owner of the database, including allowed remote
connections, both TCP/IP and NamedPipe. Everything "looks" correct,
but no connection and the above-mentioned Windows error message. I am
just stumped, so I'd love to hear any ideas or advice from anyone who
has seen this before.
 
E

Earl

Actually, I did find the error in the app startup. It was a 3rd-party
component missing references.

Roger Wolter said:
The one thing that seems to stand out to me is that you have never
mentioned any error or message coming from SQL Express. A file not found
error from the .Net framework seems to be unrelated to the database. You
seem convinced that this is a database error but you haven't given any
evidence of this. Have you debugged through the application startup to
see where the exception is thrown?

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Earl said:
If anyone is still following this thread ... I've had the same response
on 3 different systems now, one was a brand new install -- XP Pro,
service pack 2, .Net 2.0 framework, SQLExpress2.0, and SSMSEE. I made no
configuration changes and accepted all defaults on the SQLExpress
install, except for one: I added the install user to the Administrator
role.

Checked the event log after the crashes. The errors are showing as ".Net
Runtime 2.0 Errors". One error showed as
"system.invalidoperationexception", but all the others showed as
"system.io.filenotfoundexception". Any thoughts?


William (Bill) Vaughn said:
Assuming you're trapping the "Exception" (generic catch-all)
exception...

Ok. By default, SQL Server Express does not expose itself on the
network. In addition, it's generally installed as a named
instance--usually "SQLEXPRESS" so the strSQLServerName must include the
instance name as in
MySystem\SQLEXPRESS
to reference it. You also need to have rights on the specified database
unless the current user is in the Admin group. You aren't using the User
Instance option which has its benefits and issues.

hth

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest
book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

1. Yes, an existing SQL Express instance (I even tested it myself with
GotoMeeting, so I can see what they have)
2. It is running
3. Windows Authentication
4. Errors -- that is where the weirdness appears -- my error messages
in the Try/Catch do not show, I get the fancy generic Windows program
error message ("We are sorry for the inconvenience..." the one where
they want you to send information to Microsoft).
5. I did not check the event log that is something I can review.
6. Connection string:

m_strConnection = "data source=" + m_strSQLServerName + ";"
+
"initial catalog="+m_strDatabaseName+";integrated
security=SSPI;";

Let's hear a bit more about your configuration. I assume you're
expecting an existing SQL Express instance on the client system. Is it
running? How are the clients authenticated? I assume you have a
Try/Catch around the Open. Does the exception occur there? Is there a
number with the error message? Did you check the client systems event
log? Let's see the ConnectionString.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest
book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

I have an issue that is totally baffling me. When I use a program I've
written to connect to SQLExpress (and a given database), all works
well on my development system and on a laptop that I tested with.
However, I have two users that I sent the SAME database files and
program files to and at the moment the program tries to connect to the
server/database, they get the generic Windows error message "[Your
Program] has encountered an error and needs to close. We are sorry for
the inconvenience."

This differs from handled exceptions and unhandled exceptions within
the program. I have had the users uninstall their older SQLExpress
and update to the recent service pack, checked various configuration
settings, including owner of the database, including allowed remote
connections, both TCP/IP and NamedPipe. Everything "looks" correct,
but no connection and the above-mentioned Windows error message. I am
just stumped, so I'd love to hear any ideas or advice from anyone who
has seen this before.
 

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