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 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 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 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
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
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
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
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 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 по такому принципу:
Все работало до …
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 |
при использовании DBGrid в ADOTable нужно добавлять все поля??? Нет не нужно.
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 |
А как сделать чтобы обновлялось во время работы программы? Переходи на запросы и будет тебе «щасье»
0 |
4 / 4 / 0 Регистрация: 18.07.2013 Сообщений: 382 |
|
12.07.2016, 10:42 [ТС] |
7 |
Переходи на запросы и будет тебе «щасье» А примерно енто как? Добавлено через 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 |
тут даже не в запросах дело, а в том что нужно понимать что ты отправляешь, что получаешь и что с этим делать Нет, у меня все просто, я записал в БД, а в DBGrid посмотрел дату и запись, т.е. у меня таблица из двух столбцов, которая увеличевается по мере записи в нее значений. Мне в этой таблице ничего по запросам не надо, она чистая проекция той, что в БД.
0 |
qwertehok 5089 / 4103 / 1026 Регистрация: 29.08.2013 Сообщений: 26,008 Записей в блоге: 3 |
||||
12.07.2016, 11:12 |
10 |
|||
Нет, у меня все просто это у меня просто
8 строк и данные из БД в таблице. я сам взял и сам положил. я знаю что с данными, они — мои.
1 |
4 / 4 / 0 Регистрация: 18.07.2013 Сообщений: 382 |
|
12.07.2016, 11:43 [ТС] |
11 |
а вы не знаете и не умеете Что правда, то правда.
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.