我的 Npgsql 版本 3.2.5 - Postgresql 9.6
我收到此错误CommandType.StoredProcedure(但CommandType.Text有效):
Npgsql.PostgresException:'42883:函数 customer_select(pEmail => 文本,密码 => 文本) 不存在'
string sql3 = @"customer_select";
NpgsqlConnection pgcon = new NpgsqlConnection(pgconnectionstring);
pgcon.Open();
NpgsqlCommand pgcom = new NpgsqlCommand(sql3, pgcon);
pgcom.CommandType = CommandType.StoredProcedure;
pgcom.Parameters.AddWithValue(":pEmail", "myemail@hotmail.com");
pgcom.Parameters.AddWithValue(":pPassword", "eikaylie78");
NpgsqlDataReader pgreader = pgcom.ExecuteReader();
while (pgreader.Read()) {
string name = pgreader.GetString(1);
string surname = pgreader.GetString(2);
}
Run Code Online (Sandbox Code Playgroud)
这是数据库中的函数:
CREATE OR REPLACE FUNCTION public.customer_select(
pemail character varying, ppassword character varying)
RETURNS SETOF "CustomerTest"
LANGUAGE 'plpgsql'
COST 100.0
AS $function$
BEGIN …Run Code Online (Sandbox Code Playgroud) 我想测试 PostgreSql 的 Store Prodecure,但出现错误。
"42809: get_customer_list() is a procedure"
Run Code Online (Sandbox Code Playgroud)
我的命令类型
CommandType.StoredProcedure
Run Code Online (Sandbox Code Playgroud)
Npgsql 是否支持 PostgreSql 11 Store Prodecure ?