Sql Connection to Godaddy MSSQL Server

I have a GoDaddy web-hosting account.  They allow me to create a SQL Server 200 Database.  They have given me code for asp, however I am using asp.net w/vb.net codebehind.  The code that they have given me to connect to their database in asp is:
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "whsql01.mesa1.secureserver.net"
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr


My code in VB.NET is this:
dim dbname as string = "my database name"
dim db_username as string = "my user name"
dim dbpassword as string = "my password"
dim connec As New OleDbConnection("Provider=SQLOLEDB;Data Source=whsql01.mesa1.secureserver.net;Initial Catalog=" & dbname & ";User Id=" & db_username & ";Password=" & dbpassword)
connec.open()

I have also tried using OdbcConnection with the exact same string as their connectstr.  With both ways I get the error SQL Server not found or access denied.  I was wondering if anyone has a solution for this or experienced the same thing with GoDaddy?  Is there something different with the way asp connects as to the way asp.net does?  Any help would be appreciated.
johnywhiteAsked:
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.

abanupCommented:
Hi,
As ur database is SQL Server, if possible  use System.Data.SqlClient.SqlConnection rather than OleDbConnection (beacuse it is more faster and efficient).

1)In case System.Data.SqlClient.SqlConnection :
      using System.Data.SqlClient
      dim connec As New SqlConnection("DataSource=whsql01.mesa1.secureserver.net;Initial  
      Catalog=" & dbname & ";User Id=" & db_username & ";Password=" & dbpassword)
     
      note : Not use provider

2) In case OleDbConnection :
       dim connec As New OleDbConnection("Provider=SQLOLEDB.1;Data        
       Source=whsql01.mesa1.secureserver.net;Initial Catalog=" & dbname & ";User Id=" & 
       db_username & ";Password=" & dbpassword)

      note : Now Provider is SQLOLEDB.1



0

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
johnywhiteAuthor Commented:
I tried both of those and still the same error. "SQL Server does not exist or access denied."
0
abanupCommented:
Hi
try this:

dim connec As New SqlConnection("Integrated Security=SSPI; Persist Security Info=False; DataSource=whsql01.mesa1.secureserver.net; InitialCatalog=" & dbname & "; User Id=" & db_username & "; Password=" & dbpassword)

note: try to give space after semicoln (but i don't think it cause any problem);
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

johnywhiteAuthor Commented:
Same error. "SQL Server does not exist or access denied."

P.S.
Data Source and Initial Catalog require spaces.  Just for if anyone else ever uses this in the future.
0
DotNetLover_BaanCommented:
Which service plan you are using ? https://www.godaddy.com/gdshop/hosting/landing.asp?se=%2B&rhl=nv%5Fweb%5F%2Fdefault%5Fhost , it shows Economy Plan does NOT support ASP.Net.
-Baan
0
johnywhiteAuthor Commented:
I am using the Delux with Asp.  My web site is also written in .NET and it works just fine.
0
DotNetLover_BaanCommented:
I suggest you talk to them about the exact SQL Server name. Because your connection string looks just fine. There is absolutely no problem.
-Baan
0
Éric MoreauSenior .Net ConsultantCommented:
Your SQL server does not allow

-Open Enterprise Manager
-Right-click your server
-Click properties
-Open the Security tab
-Set Authentication to "SQL Server and Windows"
-Let the service restart
0
johnywhiteAuthor Commented:
It turns out that they don't allow connections to a database through .NET only through asp, even though they offer .NET as an option.
Thanks for all of the help I appreciate it.
0
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
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.