Npgsql连接PG数据库报错

cstslqq 2013-05-10 12:53:45

/// <summary>
/// get dataset
/// </summary>
/// <param name="strSQL">(string)</param>
/// <returns>(DataSet)</returns>
public static DataSet Execute4Ds(string strSQL)
{
NpgsqlConnection myCn = new NpgsqlConnection(strPostgreConn);
try
{
LogManage.LogError("open connection begin ");
myCn.Open();
LogManage.LogError("open connection success");
NpgsqlDataAdapter sda = new NpgsqlDataAdapter(strSQL, myCn);
DataSet ds = new DataSet("ds");
sda.Fill(ds);
LogManage.LogError("fill ds");
return ds;
}
catch (NpgsqlException e)
{
LogManage.LogError(e.Message);
throw new Exception(e.Message);
}
finally
{
myCn.Close();
}
}

Npgsql连接PG数据库报错:
The type initializer for 'NpgsqlTypes.NpgsqlTypesHelper' threw an exception.
...全文
241 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

972

社区成员

发帖
与我相关
我的任务
社区描述
PostgreSQL相关内容讨论
sql数据库数据库架构 技术论坛(原bbs)
社区管理员
  • PostgreSQL社区
  • yang_z_1
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧