ASP.Net 1.1 and SQL Server 2000

I have recently joined a new company.
I have a computer with both .Net 1.1 & 2.0 installed. Also the Sql server 2000 client components are installed.

If I create a winforms application, it works fine. but if I create a basic ASP.Net application & try connecting to a sql server, I get a message that "SQL server does not exist or access denied".

The sql server does exist for sure, hence it probably is some kind of access issue, TCP/IP, Named pipes or something else. I have also enabled the TCP\IP and namedpipes.

The funny thing is that the ASP.Net applications that the previous programmer had created, they still do work. only new applications that I create are not working.

Attached in the code snippet is the very basic ASP.Net application that I tried to create on this computer, but it gives a message that "SQL Server does not exist or access denied".

Please advise, why would this be happening.
Thanks for your help in advance.

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sqlconn As New SqlClient.SqlConnection
             sqlconn.ConnectionString = "server= Earth;database=CTSY2K;user id=Username;password=******;Network Library =dbmssocn"
        Catch sqlerror As Exception
        End Try
        If sqlconn.State = 1 Then
            Response.Write("SQL server is connected")
        End If
    End Sub

Open in new window

Who is Participating?
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.

why do you need network library in the parameters? This would force it to use TCP/IP in an ADO connection but since you are using VB.Net you are using an SQL Client connection. Try deleting that.
did you try with IPaddress instead of the server name, try like this(replace,1433 with actual ip address and the port. default is 1433)

sqlconn.ConnectionString = "server=,1433;database=CTSY2K;user id=Username;password=******;Network Library =dbmssocn"

or this

sqlconn.ConnectionString = "Data,1433;Network Library=DBMSSOCN;Initial Catalog=CTSY2K;User ID=Username;Password=Password;"

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
vdesai_8Author Commented:
sqlconn.ConnectionString = ";database=CTSY2K;user id=sa;password=xxxxxxx"

The above connection string worked! Thanks Gurus!
but I am concerned about 2 things:

1). I would like to give the name of server instead of the IP address, in the connection string.
eg: sqlconn.ConnectionString = "server=Testserver;database=CTSY2K;user id=sa;password=******"

2). If I mention the port 1433 in the connection string, it gives an error, that the specified SQL server could not be found. not sure why...

Please advise.


The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Perhaps your SQL is not running on the default port which is 1433. You can run your Server Network utility and see what port SQL is running from.

Also if it's in your local network and you cannot access it with the name then you might need to configure it on each machine in the Client Network utility to use named pipes instead of TCP/IP and specify the pipe name, or use TCP/IP and not named pipes. You can do whatever suits your case.
vdesai_8Author Commented:

The sql server is running on port 1433. Also my Client network Utility is set up as shown in the attached file.

not sure why I cannot access the connection string using the servername rather than IP address.

Please help. Thanks!

Hi vdesai,

Apologies for my late reply but for some reason I couldn't download the file all day long for some reason. Are you running the sql server on a default instance? If not then try this instead in your pipe:

If you are your pipe looks correct but it would be best if you had verified it with the one shown in the server network utility where your server is installed.

Also can you try and see if can see the machine with it's name on your network? Maybe it just can't resolve the name correctly. Try an nslookup and see if the name matches the correct ip.
vdesai_8Author Commented:
Yes Yiogi, the SQL Server is running on a default instance. I verified the pipes too on both Client & Server, & they do match.

How can I perform nslookup?

open a command prompt and type "nslookup servername"
vdesai_8Author Commented:
Dear experts I have to work on some other task for the next three weeks, so please pardon me if I am not able to reply for the next 2 to 3 weeks. Thanks!
vdesai_8Author Commented:
Thanks experts! & sorry for the late reply.
vdesai_8Author Commented:
Thanks experts! & sorry for the late reply.
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
.NET Programming

From novice to tech pro — start learning today.