//获取连接字符串,不过要在"引用"中添加对Configuration的引用
public static string GetConnStr() { return system.Configuration.ConfigurationManager.AppSettings["ConnStr"]; }
2
//获取连接对象,直接是打开过的
public static SqlConnection GetConn() { SqlConnection Conn = new SqlConnection(GetConnStr()); Conn.Open(); return Conn; }
3