Problem ASP.NET to SQL Server

T

Tim Almond

Already posted to sql server group but maybe some help here....

If I run my application, I get a 'database does not exist'. If I then go
onto the machine with the database on (different machine) and log in to
query analyser, I can then go back to the web browser, it connects fine.

Three machines involved...
My PC
web server
db server

Order of events is...
go onto my PC, try and connect to web server via HTTP... fails with unknown
DB
do a remote connection to db server, log in
go back to my PC, try and connect to web server via HTTP... works fine.

It seems strange, like logging into the DB starts it polling itself as alive
or something.


The SQL Connection string is
server=1.1.1.1;database=dname;uid=****;password=********* with the names
changed to protect the guilty.
 
L

Lars Netzel

Try adding this parameter to the connectionstring as well

data source="1.1.1.1\SQLINSTANCENAME"

You gotta specify what Sql instace you want to connect to since it's
possible to have several!

/Lars
 
T

Tim Almond

Thanks, Lars.

Something that hasn't been explained to me - what is the difference between
using INITIAL CATALOG and DATABASE?
 
T

Tim Almond

How do I find out the SQLINSTANCENAME?

Also, is it worth me trying a try...catch block on the code or not? Would it
maybe give me any more information than I'm currently getting?
 
L

Lars Netzel

I've never really seen a differance here, use whatever of them, I think
Initial Catalogue is more common though.

/Lars
 
L

Lars Netzel

You mean debugging, no I don't think debugging will help you here.

The instanse name should be har dto find, what SQL server are you using, the
Enterprice or just the MSDE version? If you are using the Enterprice Manager
to view database you should see the instancename in the navigation tree to
the left.

You might also find the InstaceName in the Controlpanel/Services and check
for the SQL service.. it'll say the name there,

/Lars
 
P

Patrice

AFAIK Server/Database is the ODBC style while Data Source/Initial Catalog is
rather the OLEDB provider style. My personal preference is to use the
later...

Patrice
 

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