Solved

TQuery Index Fields

Posted on 1998-11-29
9
1,945 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 50 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

749 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