[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

TQuery Index Fields

Posted on 1998-11-29
9
Medium Priority
?
2,026 Views
Last Modified: 2012-06-27
I am trying a refresh of the current record using a TQuery (trying to get an updated record). The procedure is available for a TQuery but Delphi reports: Table does not support this operation because it is not uniquely indexed.

The table (on the server) is indexed. Do I have to define indexes similar to the TTable component? If so how. I see that the TTable component has properties for indexes where as the TQuery does not.

The database is on a MySQL server using the MyODBC driver. The driver is designed well and functions well throughout Delphi.

Any help is appreciated.
0
Comment
Question by:dave1968
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 1

Author Comment

by:dave1968
ID: 1348566
Adjusted points to 50
0
 
LVL 1

Expert Comment

by:Gerhard100198
ID: 1348567
Just a couple of questions:

1) Are you making use of a TUpdateSQL component?

2) Are your query doing a join between tables or is it a simple query?

3) Are your TQuery component set to request a live result set?

4) Which database are your TQuery connected to? (Paradox, Interbase etc).

I've come across this situation with Interbase some time ago. Using the DBExplorer it was possible to add two or more identical records to the same table even though the table was set up with a unbique key field (not to sure whether this was a DBExplorer or an Interbase bug). If you then tried to delete any one of these records by hitting the DEL key in DBExplorer you would receive the error your described above. The only way to get rid of the "duplicate entries" were to do it with an SQL statement (delete from MYTABLE where MYFIELD = 'ABC123456'). This would then remove ALL of these duplicate entries since they all have the same key value. We then had to re-enter the information for that record into the table.
0
 
LVL 1

Author Comment

by:dave1968
ID: 1348568
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is 'select * from items'
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:Gerhard100198
ID: 1348569
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is 'select * from items'
0
 
LVL 3

Expert Comment

by:Stefaan
ID: 1348570
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is 'select * from items'
0
 
LVL 1

Author Comment

by:dave1968
ID: 1348571
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is 'select * from items'
0
 
LVL 3

Expert Comment

by:Stefaan
ID: 1348572
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is 'select * from items'
0
 
LVL 1

Author Comment

by:dave1968
ID: 1348573
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is 'select * from items'
0
 
LVL 1

Accepted Solution

by:
slautin earned 100 total points
ID: 1348574
1. Not using TUpdateSQL, just the TQuery component.
2. Straight simple query, no joins.
3. Tried live set and not live, same error.
4. ODBC database on a SQL server.

The procedure I am calling is Query1.Refresh, which according to the documentation should refresh the record the cursor is on. I used this TQuery for a read only list, so a live set is not necessary. When I do an update to the table with a different TQuery or a different means I want to run a Query1.Refresh to get the latest data.

Query1.SQL is "select * from items"
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question