since ‎27-05-2015
‎10-12-2019
KelvinSmith
Level 1
Re: Unable to connect to a remote database through ASP. NET ( ASPHostPortal.com Hosting )
Avatar

KelvinSmith

KelvinSmith
- Adobe Experience Cloud
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); conn.Open(); SqlCommand cmd = new SqlCommand(msg,conn); cmd.ExecuteNonQuery(); conn.Close(); return 1;}Hope it works.Regards

Views

95

Likes

0

Replies

0