DataSet is a generic class, it doesn't keep the original data's datatype, try to use the Connection object's Get*SchemaTable method to retrieve the data type for the original data or seeHOW TO: Retrieve Column Schema by Using the DataReader GetSchemaTable Method and Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;EN-US;310107
http://support.microsoft.com/default.aspx?scid=kb;EN-US;310107
就是C#的字段,和SQL SERVER的字段有不完全的对应关系
或者另外写sql语句从数据库中得到这些字段的类型。
直接从数据库中返回与DATASET对应的一张表就可以了。
得到列信息。
myReader.FieldCount 获取当前行中的列数
myReader.GetFieldType(序号) 获取是对象的数据类型的 Type
myReader.GetDataTypeName(序号) 获取源数据类型的名称
myReader.GetName(序号) 获取指定列的名称
myReader.GetOrdinal(序号) 在给定列名称的情况下获取列序号