public void InsertEmployment(DLAEmployeeExport item, SqlConnection sqlConnection1) { try { System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("InsertEmployment", sqlConnection1); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("@BusinessTitle", SqlDbType.Char); cmd.Parameters["@BusinessTitle"].Direction = ParameterDirection.Input; cmd.Parameters["@BusinessTitle"].Value = item.PositionCategory; sqlConnection1.Open(); cmd.ExecuteNonQuery(); } catch (System.Exception se) { Console.WriteLine(se.Message); } finally { /// if the connection is not null if (sqlConnection1 != null) { ///check if the connection is open, if so then close it if (sqlConnection1.State == ConnectionState.Open) sqlConnection1.Close(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)