Access 奇怪问题

来源:互联网 发布:自学数据库要多久 编辑:程序博客网 时间:2024/05/16 10:34
遇到个奇怪的问题,没有搞明白是什么原因,当通过OledbDataReader取Access数据库表结构时,竟然能取到表中不存在的字段信息。在这里应该产生个异常才对.........

          table1 中只有一个字段 id。

           DbCommand command=...................;
           command.CommandText  = "select  id,name,age from table1";
           DbDataReader reader = null;
           DataTable dtFields = null;

            try
            {           
             
                reader = command.ExecuteReader(CommandBehavior.KeyInfo |CommandBehavior.SchemaOnly);
                dtFields = reader.GetSchemaTable();
                //
                //但是在这里取出来的是id,name,age 的信息。 奇怪              
                //
            }
           finally
            {
                 reader.Close();              
            }
       
原创粉丝点击