SqlDataReader dr = DB.getErrorInfo(Convert.ToDateTime(time), table);
               for (int i = 0; i < dr.FieldCount; i++)                   //str.Add(dr[i]);                  textBox1.Text += dr[i].ToString();public SqlDataReader getErrorInfo(DateTime time, string table)
        {
            try
            {
                con = getCon();
                con.Open();
                string sql = "select * from " + table + " where datetime= '" + time + "'";
                cmd = con.CreateCommand();
                cmd.CommandText = sql;
                SqlDataReader dr = cmd.ExecuteReader();
                //for(int i=0;i<dr.fieldconut;i++)
                //textbox.text=df[i]
                return dr;            }
            catch (Exception e)
            {
                LogFile.Log(e.Message);
                System.Windows.Forms.MessageBox.Show("数据库操作失败!");
            }
            
            return null;
        }
SqlConnection con = null; //定义一个类属性,类型为SQL连接
        SqlCommand cmd = new SqlCommand(); //针对 数据库操作的命令对象
        public SqlConnection getCon()
        {
            string conn = usexml.getConstring();
            con = new SqlConnection(conn);
            return con;
          
        }
错在那里呢?