开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜