日期:2014-05-17 浏览次数:20408 次
public static SqlConnection CreateCon() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString); return con; } public static SqlDataReader getRow(string sql) { SqlConnection con = CreateCon(); try { con.Open(); SqlCommand com = new SqlCommand(sql, con); SqlDataReader sdr = com.ExecuteReader(); return sdr; } catch (Exception ex) { Logs.FileLog( sql + " | " + ex); throw; } finally { con.Close(); con.Dispose(); } }