日期:2014-05-20  浏览次数:22514 次

未将对想引用设置到对象的实例 郁闷死了
private static SqlConnection con;
  public static SqlConnection Con
  {
  get 
  {
  string conString = ConfigurationManager.ConnectionStrings["HR"].ConnectionString;
  if (con == null)
  {
  con = new SqlConnection(conString);
  con.Open();
  }
  else if (con.State == System.Data.ConnectionState.Closed)
  {
  con.Open();
  }
  else if (con.State == System.Data.ConnectionState.Broken)
  {
  con.Close();
  con.Open();
  }
  return con;
  }
  }


哪个地方出错了啊。好纠结

------解决方案--------------------
C# code
string conString = ConfigurationManager.ConnectionStrings["DBConnctionString"].ConnectionString;