PgSql 提示42P01错误!试了很多方法还是报错

 private static string connectionString = "server=10.31.180.3;Port=5432;Database=postgres;uid=postgres;pwd=hik12345+";
        //创建数据库连接对象
        NpgsqlConnection con = new NpgsqlConnection(connectionString);
        private void GetHistory()
        {
            int addCount = 0,updateCount=0;

            DateTime maxDate = new BLL.Passenger_Day_srcBLL().GetMax("create_time");//最大时间
            if (maxDate.Subtract(DateTime.Now).Days == 0)
            { //最大时间如果是今天 ,查找
                maxDate = DateTime.Now.Date;
            }

            //定义查询语句,这里最好将SQL语句在SQL中写好并验证正确确在复制粘贴过来(在对数据查询时最好只查所需的一些不需要的数据就不要取出,这样可以提高运行的效率)
    string strSql = " select sum(case when date_no = cast(to_char(now(),'yyyymmdd') as integer) then 1 else 0 end from dwb_gov_office_item_list_min";

            NpgsqlDataAdapter sda = new NpgsqlDataAdapter(strSql, con);
            DataSet ds = new DataSet();
            sda.Fill(ds);//把执行得到的数据放在数据集中      ---执行到这里就报错 提示 42P01 关系“[dwb_gov_office_item_list_min]”不存在
           // dataGridViewTest.DataSource = ds.Tables[0];
            con.Close();
            DataTable dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    int devId = 0;
                    Model.D_Device devModel = new BLL.D_DeviceBLL().GetModel(" and Remarks='" + dr["src_index"].ToString() + "'");
                    if (devModel != null)
                    {
                        devId = devModel.DevId;
                    }
                    // string strWhere = " and DataId='" + dr["id"].ToString() + "' and create_time='" + ((DateTime)dr["create_time"]).ToString("yyyy-MM-dd HH:mm:ss.fff") + "' ";
                    string strWhere = " and DataId='" + dr["id"].ToString() + "'";
                    Model.Passenger_Day_src modelPDay = new BLL.Passenger_Day_srcBLL().GetModel(strWhere);
                    if (modelPDay != null)
                    {
                        modelPDay.update_time = ((DateTime)dr["update_time"]).ToString("yyyy-MM-dd HH:mm:ss.fff");//修改时间
                        modelPDay.enter_count = int.Parse(dr["enter_count"].ToString());//进人数
                        modelPDay.exit_count = int.Parse(dr["exit_count"].ToString());//出人数
                        new BLL.Passenger_Day_srcBLL().Update(modelPDay);
                        updateCount ++;
                    }
                    else
                    {
                        modelPDay = new Model.Passenger_Day_src();
                        modelPDay.DevId = devId;
                        modelPDay.DataId = dr["id"].ToString();
                        modelPDay.create_time = ((DateTime)dr["create_time"]).ToString("yyyy-MM-dd HH:mm:ss.fff");//创建时间
                        modelPDay.update_time = ((DateTime)dr["update_time"]).ToString("yyyy-MM-dd HH:mm:ss.fff");//修改时间
                        modelPDay.date_time = dr["date_time"].ToString();//统计时间
                        modelPDay.src_index = dr["src_index"].ToString();//监控点ID
                        modelPDay.src_dev_index = dr["src_dev_index"].ToString();//资源点ID
                        modelPDay.enter_count = int.Parse(dr["enter_count"].ToString());//进人数
                        modelPDay.exit_count = int.Parse(dr["exit_count"].ToString());//出人数
                        new BLL.Passenger_Day_srcBLL().Add(modelPDay);
                        addCount++;
                    }
                }
                AddMsgItem("客流数据:新增【"+ addCount + "】条,修改【"+ updateCount + "】条");
            }
        }
        #endregion

 

可否把报错发给我看看,py库查询时需要在表名前加模式名称,就是这张表属于哪个schema(模式),不然查询时可能找不到表。

这个其实就是告诉你"dwb_gov_office_item_list_min“这张表不存在,在你上面的数据库截图里面的确也没看到这张表(可能在下面没截到?)
另外,可以尝试把 "dwb_gov_office_item_list_min"这个表名,改成 "datacentre.dwb_gov_office_item_list_min",
或者修改连接串,增加SearchPath或者currentSchema参数,不指定schema时,默认是在public下面