Field not found ошибка

I have the following query to one of my database tables:

select count(*) as mycount
  from mytable
 where fieldone = :fieldone
   and fieldtwo = :fieldtwo

Parameters are correctly loaded into the query (both of type String).

When I run this query outside the app (for instance, through the dbexplore) and replace the parameters with the actual values, I get the correct result. But when running it in the app, I get a Field 'fieldtwo' not found error, right on the Query.Open call.

Why would the BDE not find this field, when it actually exist?

Update: The following query, executed right after the first one (the one that fails), works fine in the app:

select *
  from mytable
 where fieldone = :fieldone
 order by fieldone, fieldtwo

asked Feb 21, 2011 at 13:59

Pablo Venturino's user avatar

Pablo VenturinoPablo Venturino

5,1685 gold badges33 silver badges41 bronze badges

3

The best guess is that you have populated the field list in the query, this overrides any concept of the underlying fields that are in the query and is a cause of countless confusion.

Right click on the query, pick the fields editor clear all the values that are there and then choose ‘add all fields’ that should cause the missing field to appear once the query is executed.

I think it should auto-populate the fields if there are no defined fields when the query is executed, so you may not need to choose ‘add all fields’ after clearing the fields.

answered Feb 21, 2011 at 14:36

Anya Shenanigans's user avatar

Anya ShenanigansAnya Shenanigans

91k3 gold badges104 silver badges120 bronze badges

1

Whenever we come across a problem like this we tend to remove the query from the form and create it dynamically at run time… It depends how ingrained into the form it is…

E.g. If you have a data aware control looking at «fieldtwo» which tries to fetch some data when the underlying data set gets updated then it’ll trigger an error like this, but it’s more obvious when you’ve written code such

SomeEdit.Text = Query.FieldByName("fieldtwo").AsString;

That way it falls over on the relevant line instead of the open (triggering a related event)

answered Feb 21, 2011 at 15:43

James Barrass's user avatar

James BarrassJames Barrass

9,7645 gold badges34 silver badges58 bronze badges

2

Clear the query content using Query1.SQL.Clear; statement before opening it.

Other reason can be you are opening other database which may not have the specified field. Be sure that both the DatabaseName's in your app and dbexplore are same

answered Feb 21, 2011 at 14:22

Bharat's user avatar

BharatBharat

6,8185 gold badges35 silver badges56 bronze badges

5

I used to face porblems with BDE when i have SQLExplorer open and the app accesses the DB at the same time (but i had errors like ), try closing the Explorer it may help, if not i would build the SQL as text without the Parameters and try if it works then (if its possible in your situation).

answered Feb 21, 2011 at 14:59

CloudyMarble's user avatar

CloudyMarbleCloudyMarble

36.8k70 gold badges96 silver badges130 bronze badges

1

I don’t use parameters, so I’m just grabbing at straws here. I still use the BDE regularly, but am no expert. I find I shy away from more complex expressions (which yours is not!) because of the little «surprises» like this that the BDE throws at you.

Perhaps adding parentheses:

 where (fieldone = :fieldone)
 and (fieldtwo = :fieldtwo)

Or, single or double quote signs (this probably will make it worse?)

 where (fieldon = ":fieldone")
 and   (fieldtwo = ":fieldtwo")

Or, to explore the problem, remove the «and fieldtwo = :fieldtwo» line and see if it runs.

Would it be possible for you to do your own parameter substitution with a StringReplace as in

 Query1.SQL.Text := StringReplace(Query1.SQL.Text, ":fieldone", "MyVarName",[rfReplaceAll   ]); 

answered Feb 21, 2011 at 15:36

RobertFrank's user avatar

RobertFrankRobertFrank

7,33211 gold badges53 silver badges98 bronze badges

2

If you are creating a ClienDataSet in memory by the Create DataSet method, you should check the TFieldDefs property, which must have a different field name or not created

answered May 23, 2017 at 2:23

Martin Miguel Parody Narvaez's user avatar

I was having a weird but small problem, I’ll post in case it will help someone in some day.

uRegPeople.pas

with frmEditPerson do
  begin
    PersonID := qryPerson.FieldByName(ID).AsInteger;
    ...
  end;

I had qryPerson both in frmRegPeople and in frmEditPerson, by using with I was referencing to frmEditPerson.qryPerson, however I wanted to reference to frmRegPeople.qryPerson. Then I need to change to the following code.

with frmEditPerson do
  begin
    PersonID := Self.qryPerson.FieldByName(ID).AsInteger;
    ...
  end;

// Explanation
// qryPerson --> frmEditPerson.qryPerson;
// Self.qryPerson --> frmRegPeople.qryPerson;

answered Dec 21, 2018 at 13:37

Soon Santos's user avatar

Soon SantosSoon Santos

2,09720 silver badges41 bronze badges

Hi Guys,

I am very new to QlikSense. I am trying to run a script which pulls the data from SharePoint.The field does exist in the exel file. And I have also checked for the name of the field to be case sensitive or not.

  I am getting the below error:

Date << Last Update Date
Lines fetched: 1

The following error occurred:
Field not found — <Team>

The error occurred here:
Checkbook:
LOAD
    Team,
    Department,
    «Year»,
    «Group»,
    Quarter,
    «Budget Line»,
    «Budget Plan $»,
    «Budget Sub-Category»,
    «Budget Category»,
    «Funnel Stage»,
    «Name/ Description»,
    «Parent Campaign»,
    «Campaign/ Initiative»,
    «Tactic/Activity»,
    «Finance Tactic Group» as «Tactic Group»,
    «Forecast Amount»,
    Committed,
    JMF,
    Vendor,
    If(Match([Tactic/Activity],’Advertising — Digital’,’Collateral — e-book’,’Content Syndication’,’E-mail’,’Event — Online’,’Online Syndication’,’Paid Search’,’SEO’,’Social Media Promotion’,’Webinar’)=0,’Other’,’Digital’) AS DigitalMarketingFlag
FROM [lib://SharePoint — Marketing Finance/Shared Documents2017 Checkbook RegistersGlobalGLOBAL checkbook.xlsx]
(ooxml, embedded labels, table is [Roll Up]) where not [Team]=0

PierL

4 / 4 / 0

Регистрация: 18.07.2013

Сообщений: 382

1

MS Access

11.07.2016, 14:37. Показов 6055. Ответов 10

Метки нет (Все метки)


Студворк — интернет-сервис помощи студентам

БД в ACCESS. Считываю и записываю данные через ADOTable по такому принципу:

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
DataModule2.FindKBQuery.Active:=False;
  DataModule2.FindKBQuery.SQL.Clear;
  DataModule2.FindKBQuery.SQL.Add('SELECT *');
  DataModule2.FindKBQuery.SQL.Add('FROM Vdol');
  DataModule2.FindKBQuery.SQL.Add('WHERE DateCMG LIKE'''+DateEdit.Text+'''And Vremya LIKE'''+TimeEdit.Text+'''' );
  DataModule2.FindKBQuery.Active:=True;
 // Edit1.Text:= IntToStr(DataModule2.FindKB1Query.RecordCount);
  if DataModule2.FindKBQuery.RecordCount>=1 then
    begin
      Application.MessageBox(PChar('Извините! В Базе за дату '+DateEdit.Text+' и время '+TimeEdit.Text+' уже есть запись!'),'Внимание!',MB_OK);
      exit;
    end;
    DataModule2.VdolTable.Append;
    DataModule2.VdolTable.Edit;
    for i:= 1 to SG.RowCount-2 do
      begin
        DataModule2.VdolTable.FieldByName(('P')+intToStr(i)).AsString:=SG.Cells[1,i];
        DataModule2.VdolTable.FieldByName(('V')+intToStr(i)).AsString:=SG.Cells[2,i];
      end;
    DataModule2.VdolTable.FieldByName('SredneeP').AsString:=SG.Cells[1,SG.RowCount-1];
    DataModule2.VdolTable.FieldByName('SredneeV').AsString:=SG.Cells[2,SG.RowCount-1];
    DataModule2.VdolTable.FieldByName('Prostenok').AsString:=ProstEdit.Text;
    DataModule2.VdolTable.FieldByName('DateCMG').AsString:=DateEdit.Text;
    DataModule2.VdolTable.FieldByName('Vremya').AsString:=TimeEdit.Text;
    DataModule2.VdolTable.Post;
    DataModule2.VdolTable.Refresh;

Все работало до …
Сегодня добавил на форму DBGrid и из-за этого пришлось в ADOTable добавить поля для отображения в DBGrid (в моем случае это Дата, т.е. таблица с одним столбцом)
После этого при записи данных в БД стало выдавать ошибку, что Field ‘P1’ not found. Пришлось добавить в ADOTable все поля для правильной работы. Т.е. получается при использовании DBGrid в ADOTable нужно добавлять все поля??? Или что-то можно поменять программно?



0



530 / 467 / 183

Регистрация: 11.12.2013

Сообщений: 2,460

11.07.2016, 16:22

2

В DBGrid можно отображать поля которые есть в ADOTable или ADOQuery. Я не понял что хотите поменять программно.



1



478 / 391 / 112

Регистрация: 24.04.2012

Сообщений: 1,622

Записей в блоге: 3

12.07.2016, 08:19

3

Цитата
Сообщение от PierL
Посмотреть сообщение

при использовании DBGrid в ADOTable нужно добавлять все поля???

Нет не нужно.
Добавьте нужное кол-во столбцов в DBGrid и укажите имена полей



1



4 / 4 / 0

Регистрация: 18.07.2013

Сообщений: 382

12.07.2016, 10:22

 [ТС]

4

Bit_Man, не подскажите. Когда записываю в БД данные, в DBGrid Они появляются только после перезапуска моей программки. А как сделать чтобы обновлялось во время работы программы?



0



530 / 467 / 183

Регистрация: 11.12.2013

Сообщений: 2,460

12.07.2016, 10:26

5

После завершения редактирования данных можно закрыть, а потом открыть запрос (или таблицу), который отображается в DBGrid.



0



478 / 391 / 112

Регистрация: 24.04.2012

Сообщений: 1,622

Записей в блоге: 3

12.07.2016, 10:33

6

Цитата
Сообщение от PierL
Посмотреть сообщение

А как сделать чтобы обновлялось во время работы программы?

Переходи на запросы и будет тебе «щасье»



0



4 / 4 / 0

Регистрация: 18.07.2013

Сообщений: 382

12.07.2016, 10:42

 [ТС]

7

Цитата
Сообщение от Bit_Man
Посмотреть сообщение

Переходи на запросы и будет тебе «щасье»

А примерно енто как?

Добавлено через 22 секунды
примерно понимаю, но не до конца.



0



5089 / 4103 / 1026

Регистрация: 29.08.2013

Сообщений: 26,008

Записей в блоге: 3

12.07.2016, 10:51

8

тут даже не в запросах дело, а в том что нужно понимать что ты отправляешь, что получаешь и что с этим делать

запрос это команда — хочу получить всех ивановых у которых зп больше 1000
ответ получаешь в виде плоской таблицы
и потом руками обрабатываешь и нужные данные в нужные места пишешь



0



4 / 4 / 0

Регистрация: 18.07.2013

Сообщений: 382

12.07.2016, 10:55

 [ТС]

9

Цитата
Сообщение от qwertehok
Посмотреть сообщение

тут даже не в запросах дело, а в том что нужно понимать что ты отправляешь, что получаешь и что с этим делать
запрос это команда — хочу получить всех ивановых у которых зп больше 1000
ответ получаешь в виде плоской таблицы
и потом руками обрабатываешь и нужные данные в нужные места пишешь

Нет, у меня все просто, я записал в БД, а в DBGrid посмотрел дату и запись, т.е. у меня таблица из двух столбцов, которая увеличевается по мере записи в нее значений. Мне в этой таблице ничего по запросам не надо, она чистая проекция той, что в БД.



0



qwertehok

5089 / 4103 / 1026

Регистрация: 29.08.2013

Сообщений: 26,008

Записей в блоге: 3

12.07.2016, 11:12

10

Цитата
Сообщение от PierL
Посмотреть сообщение

Нет, у меня все просто

это у меня просто

Delphi
1
2
3
4
5
6
7
8
9
10
i:=1;
query.sql.text:='select a,b from T';
query.open;
while not query.eof do begin
  stringgrid.cells[0,i]:=query.fields[0].asString;
  stringgrid.cells[1,i]:=query.fields[1].asString;
  i:=i+1;
  query.next;
end;
query.close;

8 строк и данные из БД в таблице. я сам взял и сам положил. я знаю что с данными, они — мои.
а вы не знаете и не умеете



1



4 / 4 / 0

Регистрация: 18.07.2013

Сообщений: 382

12.07.2016, 11:43

 [ТС]

11

Цитата
Сообщение от qwertehok
Посмотреть сообщение

а вы не знаете и не умеете

Что правда, то правда.



0



Symptom

The JCo function call fails with this error:

The defaultTrace.X.trc or JCO* file contains this exception:

Exception in thread <thread ID> com.sap.conn.jco.JCoRuntimeException: (127) JCO_ERROR_FIELD_NOT_FOUND: Field <field name> is not a member of OUTPUT
  at com.sap.conn.jco.rt.AbstractMetaData.indexOf(AbstractMetaData.java:404)  
  at com.sap.conn.jco.rt.AbstractRecord.getString(AbstractRecord.java:2909)

Problem

The Java application tries to access a non existing field.

Solution

Clear the metadata cache, in case the function parameters have been changed. In NetWeaver Administrator tool navigate to JCo Monitor, in Matadata Cache tab the cache content can be deleted.

Check the function parameter list.

See SAP note #1479970 — Changes in RFC modules are not reflected in Java Server

I’m also on Hasura, using version v1.2.2 and got this error. Unlike others, theres nothing wrong with my permissions, and even restarting the server locally on Docker did nothing to fix this.

Edit:

Was caused because my setup had 2 hasura servers running at the same time, but I didn’t set the proper api-port for the second server, so the 2 servers had been running with the same api-port. This caused issues where my client was querying data on localhost:8080 but in reality I had the server on that shut down and my actual server I thought I was querying to was actually on localhost:8090. Somehow even though there was no server on localhost:8080, it was somehow querying data from that, and there were some weird inconsistencies and behaviour.

I just had to reset my docker instances wiping out their memory to get a clean state, then recreated the containers and applied the schema and the metadata to restore the server state. Also my client is now querying data on the proper endpoint.

hasura/graphql-engine#5097

Hope this may help anyone else in a similar situation

Edit 2:

Got this error yet again. My old answer didn’t work since there wasn’t any changes to my database, but rather I had called a new and different mutation in place of an old one. This time I fixed it by fixing my query, which didn’t have the return object structured properly (was caused because the syntax checking for my graphql queryy didn’t work properly and I didn’t copy and paste the query properly).

Edit 3: (May 4 — 2021)

Got it yet again. Somehow I keep on getting this problem and I end up constantly googling the answer and going back to here.

This time I did nothing to my code as I was developing normally, then I had to restart my computer because of a MacOS update. Seems like after restarting and setting things up again, I get this bug. This time I’d get an error that it couldn’t query and tables on query_root (from Hasura I think).

I fixed this somehow by changing the .env file’s DB_ENDPOINT and setting it to the appropriate url of the hasura server running locally. The port was wrong and it had to be corrected. I’m not sure what caused the port to be changed, or how I managed to be developing this whole time with the wrong port. But either way, it works.

Понравилась статья? Поделить с друзьями:
  • Ficbook внутренняя ошибка сервера 5xx
  • Fiat ошибка p0215
  • Fiat stilo ошибка ebd
  • Fiat stilo ошибка c1522
  • Fiat punto ошибка p1773