日期:2014-05-17  浏览次数:20438 次

DBhelper&DBhelper&DBhelper&DBhelper来看看这个有缺陷吗?
这个DBhelper可以吗?有些没用到SqlParameter的方法不安全?谁有更好一点的DBHELPER?

private static SqlConnection sc;
        public static SqlConnection Sc
        {
            get
            {
                string StrConWeb = ConfigurationManager.ConnectionStrings["YunNiao"].ConnectionString;
                try
                {
                    if (sc == null)
                    {
                        sc = new SqlConnection(StrConWeb);
                        sc.Open();
                    }
                    else if (sc.State == ConnectionState.Closed)
                    {
                        sc.Open();
                    }
                    else if (sc.State == ConnectionState.Broken)
                    {
                        sc.Close();
                        sc.Open();
                    }
                    return sc;
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }
            }
        }

 &n