日期:2014-05-18 浏览次数:20911 次
public static int ExecuteSqlByTime(string SQLString,int Times) { [color=#FF0000]using (SqlConnection connection = new SqlConnection(connectionString))[/color] { [color=#FF0000]using (SqlCommand cmd = new SqlCommand(SQLString,connection))[/color] { try { connection.Open(); cmd.CommandTimeout=Times; int rows=cmd.ExecuteNonQuery(); return rows; } catch(System.Data.SqlClient.SqlException E) { connection.Close(); throw new Exception(E.Message); } } } }