Denied access to SQL Server through Asp.net application

Howdie

My web app runs on my machine fine when querying the local database.
However when I want the app to query a sql server instance on another machine on the network
it does not allow me access. I know my connection string is correct - I can access
the database through Enterprise manager, and definately am using the right username
and password. The error message is something to this effect "Cannot connect to server, invalid
username or instance doesn't exist" - poor description but am not at work to get the exact message.
It fails when doing the whole objConnection.Open() thing.
However it works fine when I am accessing the web app when connection through the Internet.
ie through a machine not connected to the network.
Any ideas ?
gusdogsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joe JenkinsCommented:
A couple questions:

1) Do you have the ability to set up a DSN?
2) If so, have you tried this method?
3) Can you post your current connect string?

Joe Jenkins
gusdogsAuthor Commented:
Hey bud, unfortunately I can only try that
when I get back to work on Monday - will let you know.
Many thanks
Joe JenkinsCommented:
Sounds good.  Thanks for checking in during the weekend.  

Talk to next week.

Joe Jenkins
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

deepaknetCommented:
You need to have both Named Pipes and TCP enabled. I guess ASP.NET would connect via TCP but Ent. Manager via Named Pipes.

Check out this: http://www.aspfaq.com/sql2005/show.asp?id=3
gusdogsAuthor Commented:
Hey Joe

Tried using a dsn to no avail, here are the error messages I get
and the respective connection strings used in each

Error Message -
SQL Server does not exist or access denied.
Connection string used -
"Server=EGGX; Database=EggX; User ID=sa; Password=3159"

Using a DSN, I get...
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
Connection string used -
"Provider=sqloledb;Data Source=EggX;Initial Catalog=EggX;User Id=sa; Password=3159;"

Once Again I'm 100% sure the credentials are correct.


Hey DEEPAKNET

Both Named Pipes and TCP are enabled.

Any other ideas guys ?

Joe JenkinsCommented:
Gusdogs,

The credentials probably are correct.  The DSN may be set up wrong... Let's see what you have..

1. Admin Tool -> ODBC Connections -> System DSN Tab
2. Select EggX DSN, hit configure

Give me a run-down of what you have in there.  Is the database selected?  That error message you posted is telling me that the SQL Server you're connecting to does not exist or that it just can't find the database.  You can try setting up a User DSN as well and when you click finish it will give you a Test Connection button to test it.  If it works from there, your identically configured SYSTEM DSN should work fine.  

Let's fill in those blanks and see what we have there.

Also, let me see your connection code in your ASP file.  That could be the source of the problem too.

Thanks!
Joe Jenkins

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joe JenkinsCommented:
I take it the DSN was configured incorrectly?  I'm glad to have been of assistance!

Joe Jenkins
gusdogsAuthor Commented:
Hey,

I didn't realise we could post a reponse and accept the answer -
new to Experts-Exchange ! Once I selected the correct database,
and not Master, it worked - what an idiot ! Thanks man.
Joe JenkinsCommented:
hah!  That's great.  I'm glad you got it.  I bet you'll never make that mistake again!  

Great job!

Joe Jenkins
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.