Sql Connection to Godaddy MSSQL Server

Posted on 2004-11-20
Last Modified: 2007-12-19
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 w/ 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 = ""
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;Initial Catalog=" & dbname & ";User Id=" & db_username & ";Password=" & dbpassword)

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 does?  Any help would be appreciated.
Question by:johnywhite
    LVL 3

    Accepted Solution

    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(";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        
 ;Initial Catalog=" & dbname & ";User Id=" &
           db_username & ";Password=" & dbpassword)

          note : Now Provider is SQLOLEDB.1


    Author Comment

    I tried both of those and still the same error. "SQL Server does not exist or access denied."
    LVL 3

    Expert Comment

    try this:

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

    note: try to give space after semicoln (but i don't think it cause any problem);

    Author Comment

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

    Data Source and Initial Catalog require spaces.  Just for if anyone else ever uses this in the future.
    LVL 18

    Expert Comment

    Which service plan you are using ? , it shows Economy Plan does NOT support ASP.Net.

    Author Comment

    I am using the Delux with Asp.  My web site is also written in .NET and it works just fine.
    LVL 18

    Expert Comment

    I suggest you talk to them about the exact SQL Server name. Because your connection string looks just fine. There is absolutely no problem.
    LVL 69

    Expert Comment

    by:Éric Moreau
    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

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now