小编Sum*_*mar的帖子

从 Asp.Net C# 应用程序执行 PostgreSQL 存储过程时出现 42809 错误

我正在将 PostgreSQL pgadmin4 (4.16v) 与 ASP.NET 应用程序一起使用。我创建了一个如下定义的过程:

CREATE OR REPLACE PROCEDURE public.usp_bind(
    )
LANGUAGE 'plpgsql'

AS $BODY$
BEGIN
      select district_id,district_name from district_master order by district_name;
END;
$BODY$;
Run Code Online (Sandbox Code Playgroud)

从asp.net应用程序我调用了上面的过程,代码如下:

NpgsqlConnection conn = new NpgsqlConnection();
        NpgsqlDataAdapter da = new NpgsqlDataAdapter();
        NpgsqlCommand cmd = new NpgsqlCommand();
        DataSet ds = new DataSet();
        public string dbconstr = dbConnectstr.Connectionstring();

        public DataSet getDatafunction(string procedure_, [Optional] string flag_)
        {
            using (conn = new NpgsqlConnection(dbconstr))
            {
                //conn.Open();
                using (da = new NpgsqlDataAdapter())
                {

                    da.SelectCommand.CommandType = CommandType.StoredProcedure;
                    da.SelectCommand.CommandText = "CALL …
Run Code Online (Sandbox Code Playgroud)

postgresql procedure npgsql

4
推荐指数
1
解决办法
7488
查看次数

标签 统计

npgsql ×1

postgresql ×1

procedure ×1