Connecting to SQL Server Database using Godaddy Windows Hosting - Please guide.

Discussion in 'Databases' 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;
    }
     
    Last edited: Mar 28, 2010
    GAdsense, Mar 28, 2010 IP