reading an array column in C#

二次信任 提交于 2019-12-11 03:36:17

问题


My code is like this, but it gives an error:

//array_field is an array of double values 
NpgsqlCommand Command = new NpgsqlCommand("SELECT array_fied from atable"); 
NpgsqlDataReader dr = Command.ExecuteReader(); 
while (dr.Read()) 
{
    double[] rrr = dr.GetDouble(dr.GetOrdinal("array_field")); 
}

The error message is: cannot implicitly convert 'double' to 'double[]'. I tried other variations as well which also didn't work.

thanks for your help Judit


回答1:


Double[] rrr = dr["array_field"] as Double[];


来源:https://stackoverflow.com/questions/18654994/reading-an-array-column-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!