开发者

C# and Pervasive, find the type of data in a column

开发者 https://www.devze.com 2023-01-21 16:16 出处:网络
I am using Pervasive and I would like to know what kind of data a column 开发者_运维知识库contains. However, the only overload of PsqlDataReader.GetFieldType accepts an int index. But I want to know u

I am using Pervasive and I would like to know what kind of data a column 开发者_运维知识库contains. However, the only overload of PsqlDataReader.GetFieldType accepts an int index. But I want to know using the column name. I guess I could just loop through all the columns and find the one with the specified name, but I do not want to do that.

Is there any way to find the data type of a column by a given column name?


You have to pair the use of GetFieldType with GetOrdinal (which returns the int index of the column):

PsqlDataReader.GetFieldType(PsqlDataReader.GetOrdinal("ColumnName"));


I am not sure, but try use it like this

 SqlDataReader.GetFieldType["ColumnName"];
0

精彩评论

暂无评论...
验证码 换一张
取 消