错误:42883:函数 insertvideo(字符变化,字符变化,双精度,整数)不存在
但是那个存储过程存在!!!为什么继续这个错误???
这是我的连接字符串:
<connectionStrings>
<add name="myConnection" connectionString="Server=127.0.0.1;
User Id=postgres; Password=myPass; Database=myDB; "/>
</connectionStrings>
存储过程在public
模式中并且可以正常工作。
using (NpgsqlConnection conn = new NpgsqlConnection(ConfigurationManager.ConnectionStrings["AxWaveConnection"].ToString()))
{
try
{
conn.Open();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
NpgsqlCommand cmd = new NpgsqlCommand("insertvideo", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new NpgsqlParameter("out_scope_id", NpgsqlDbType.Bigint));
cmd.Parameters["out_scope_id"].Direction = ParameterDirection.Output;
cmd.Parameters.Add(new NpgsqlParameter("in_youtubeidvideo", NpgsqlDbType.Varchar, 15));
cmd.Parameters["in_youtubeidvideo"].Value = VideoId;
cmd.Parameters.Add(new NpgsqlParameter("in_title", NpgsqlDbType.Varchar, 200));
cmd.Parameters["in_title"].Value = Title;
cmd.Parameters.Add(new NpgsqlParameter("in_rating", NpgsqlDbType.Double));
cmd.Parameters["in_rating"].Value = Rating;
cmd.Parameters.Add(new NpgsqlParameter("in_viewcount", NpgsqlDbType.Integer));
cmd.Parameters["in_viewcount"].Value = ViewCount;
try
{
cmd.ExecuteNonQuery();
scopeID = Convert.ToInt64(cmd.Parameters["out_scope_id"].Value);
}
catch (Exception e)
{
scopeID = -1; //Duplicate Record
}
conn.Close();