public void run(string sql, excuteSql <SqlCommand> exec) { SqlCommand SqlCommand = getSqlCommand(sql); sqlConn.Open(); try { exec(SqlCommand); }catch (SqlException ex) { } finally { sqlConn.Close(); } }
public void run(string sql, excuteSql <SqlCommand> exec) { SqlCommand sqlCommand = getSqlCommand(sql); //解决可能超时的问题 sqlCommand.CommandTimeout = 18000; sqlConn.Open(); try { exec(sqlCommand); }catch (SqlException) { } finally { sqlConn.Close(); } }