I have a ASP.NET website and an hosting account on asphostportal.com.
I created a SQL Server Database with Direct Access and updated the connection string with the one provided by asphostportal
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:
SqlConnection conn =
SqlCommand cmd =
SqlDataAdapter da =
DataSet ds =
conn.ConnectionString = connString;
cmd = conn.CreateCommand();
cmd.CommandText = msg;
What could be the issue?
What I think is we need to open the connection before assigning it to the command. Can you try this code and see whether it works:
public int run_sql(string msg)
SqlConnection conn = new SqlConnection(connString);
SqlCommand cmd = new SqlCommand(msg,conn);
Hope it works.