Connecting to SQL Server Database using Godaddy Windows Hosting - ASP.NET C#

Discussion in 'C#' started by GAdsense, Mar 28, 2010.

  1. #1
    I've made the SQL Server database, created tables, and using the same tables i've created a basic application for my project using localhost SQL Server installation.

    Now I'd like to connect it to web SQL Server located at Godaddy. Following is the script am using to connect to the web database, it works fine with localhost but doesn't connect to Godaddy SQL Server.

    Kindly guide.

    Am using ASP.NET C# as you can see below.

    var con2 = new SqlConnection("Data Source=p3nmssqladmin.secureserver.net;Initial Catalog=dbname;User Id=user;Password=pass;");
    var com2 = new SqlCommand { Connection = con2 };

    var queryString2 =
    String.Format("insert into GPS values ({0},{1},{2},default)", id, lat, lon);

    com2.CommandText = queryString2;

    try
    {
    con2.Open();
    com2.ExecuteNonQuery();
    xlblError.Text = "Success";
    }
    catch (Exception exp) {
    xlblError.Text = exp.Message;
    }
     
    GAdsense, Mar 28, 2010 IP
  2. john.michael.kane.kane

    john.michael.kane.kane Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    all file upload Godaddy web Server!
    so Godaddy SQL Server is no open remote connect .
     
    john.michael.kane.kane, Mar 29, 2010 IP
  3. lazystream

    lazystream Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    use datacontexts, much easier to work with,

    System.Data.Linq.DataContext
     
    lazystream, Apr 16, 2010 IP
  4. CaseyM

    CaseyM Peon

    Messages:
    289
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    GoDaddy do not allow remote connections :( I have hosting with them and dba is a nightmare. GoDaddy also dont allow out remote connections.


    Upload your application via ftp, then run it live and it will connect to your db.
     
    CaseyM, Apr 19, 2010 IP
  5. CaseyM

    CaseyM Peon

    Messages:
    289
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Just found out that you can actually allow remote connections. You have to enable the feature though when you are creating the DB. This works for both MS SQL and MySQL.
     
    CaseyM, Apr 22, 2010 IP