I can not deal with this problem. The program falls with an error: the отношение "USERS" не существует even though the given table exists in the database and the query inserted into the SQL manager is successfully executed.

What could be the problem?

  public void selectDataForSync() //data from PG that whould be insert in SQLLITE { UserData ud; List<UserData> uds = new List<UserData>(); NpgsqlConnection conn = new NpgsqlConnection("Server=127.0.0.1;Port=5432;User Id=" + config.PGLogin + ";" + "Password=" + config.PGPass + ";"); conn.Open(); string SQLrequest = @"SELECT guid, username, ""FL"", id, userblob FROM ""USERS"" WHERE ""FL""=10;"; Console.WriteLine(SQLrequest); NpgsqlCommand command = new NpgsqlCommand(SQLrequest, conn); try { NpgsqlDataReader dr = command.ExecuteReader(); // here exception while (dr.Read()) { // UserData ud = new UserData(); ud.id = Int32.Parse(dr[0].ToString()); ud.guid = (dr[1].ToString()); ud.name = (dr[2].ToString()); ud.userblob = (byte[])dr[3]; // uds.Add(ud); //File.WriteAllBytes("outputimg.jpg", ud.userblob); //Console.ReadKey(); sqllite.insertDataFromPGToSQLLite(ud); } dr.Dispose(); // releases conenction } catch (Exception e) { Console.WriteLine("SelectDataForSync function"); Console.WriteLine(e.Message); } finally { conn.Close(); } } 

I tried to specify the schema - it did not help: string SQLrequest = @"SELECT guid, username, ""FL"", id, userblob FROM public.""USERS"" WHERE ""FL""=10;";

Relationship does not exist

Closed due to the fact that off-topic participants Pavel Mayorov , aleksandr barakin , zRrr , insolor , PashaPash 11 May '16 at 6:51 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Pavel Mayorov, aleksandr barakin, zRrr, insolor, PashaPash
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Give the code text, not a picture - PashaPash
  • Try explicitly specifying the scheme: SELECT guid, username, ""FL"", id, userblob FROM public.""USERS"" (most likely public scheme, but if not, substitute your own). - kmv
  • I tried the same thing. - Dmitry Bubnenkov
  • 3
    You didn’t specify a base in ConnectionString - Donil

0