User53449276 posted
Hi, I am trying to insert a web form into database. I got error message "Exception Details: System.Data.SqlClient.SqlException: Invalid object name .."
My code as below:
string strConn = WebConfigurationManager.ConnectionStrings["connectionstr"].ConnectionString;
SqlConnection conn = new SqlConnection(strConn);
conn.Open();
SqlCommand comm = new SqlCommand();
comm.CommandText = "Workorder";
comm.CommandType = CommandType.StoredProcedure;
comm.Connection = conn;
comm.Parameters.AddWithValue("options", options);
comm.Parameters.AddWithValue("title", txttitle.Text);
comm.Parameters.AddWithValue("address_", txtaddress.Text);
comm.Parameters.AddWithValue("address2", txtaddress2.Text);
comm.Parameters.AddWithValue("city", txtcity.Text);
comm.Parameters.AddWithValue("state_", txtstate.Text);
comm.Parameters.AddWithValue("zip", txtzip.Text);
comm.Parameters.AddWithValue("phone", txtphone.Text);
comm.Parameters.AddWithValue("email", txtemail.Text);
comm.ExecuteNonQuery();
...
The application worked before. I just got a new laptop and installed new version of visual studio 2017. The application compiles fine. Not sure where the problem is.