Base solution for your next web application
Open Closed

Unable to connect to a remote database through ASP. NET #140


User avatar
0
ayselim created

I created a SQL Server Database with Direct Access and updated the connection string with the one provided by [http://asphostportal.com.])

There are no errors, but I see no data being stored in the database on a form submit.

Code to insert a row is as follows:
public int run_sql(string msg)
{
    SqlConnection conn = new SqlConnection();
    SqlCommand cmd = new SqlCommand();
    SqlDataAdapter da = new SqlDataAdapter();
    DataSet ds = new DataSet();
    conn.ConnectionString = connString;
    cmd = conn.CreateCommand();
    cmd.CommandText = msg;
    conn.Open();
    cmd.ExecuteNonQuery();
    conn.Close();
    return 1;

}

What could be the issue?


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Are you writing to a wrong forum? This is not a general-purpose ASP.NET discussion forum. Your message seems unrelated to ASP.NET Boilerplate.