标签:upd name turn span command ret mes open() comm
1 private static string connString = ConfigurationManager.ConnectionStrings["connString"].ToString();
2 3 /// <summary> 4 /// 执行增、删、改操作 5 /// </summary> 6 /// <param name="sql">SQL语句</param> 7 /// <returns></returns> 8 public int Update(string sql) 9 { 10 SqlConnection sqlConnection = new SqlConnection(connString); 11 SqlCommand sqlCommand = new SqlCommand(sql, sqlConnection); 12 try 13 { 14 sqlConnection.Open(); 15 return sqlCommand.ExecuteNonQuery(); 16 } 17 catch (Exception ex) 18 { 19 string errorinfo = "调用public int Update(string sql)方法时发生错误" + ex.Message; 20 WriteLog(errorinfo); 21 throw new Exception(errorinfo); 22 } 23 finally 24 { 25 sqlConnection.Close(); 26 } 27 }
标签:upd name turn span command ret mes open() comm
原文地址:https://www.cnblogs.com/zhuyz0602/p/9347826.html