Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple rows with singleton select

Status
Not open for further replies.

debbee

Programmer
Oct 17, 2001
3
US
I am using Borland's Delphi working with a simple database structure.

Basic structure is
1. Name table, including a MasterID, which increments with each entry.
2. Session table, with session number, Session ID which increments with each entry, and a MasterID field that links to MasterID in Name
3. Image table, with image number, Image ID which increments, and a Session ID field that links to Session ID in Session table.

The program works for a stand-alone system, which adds images, per session, for each person.

SQL queries are used to store data.

Basically, without being set up as Server-Client, we have multiple systems taking images. With the same name, there would be duplications of session numbers and image numbers.

So in the program, I check for duplication, change the session number, using the next available number. Master ID and Session ID are also changed. The first entry is stored, but when I try to open the Name table again, I keep getting the error message:
General SQL Error, Multiple rows with singleton select.

The message is clear, the original session number is a duplicate. But the number is changed before adding to the database.

If I hardcode the duplicate session number to a different number, the program works just fine.

I had checked very carefully for mistakes and found none.

Any clues or suggestions?
 
What database are you using?

Are you joining the tables when you open the Name query?

Have you verified that there are or are not duplicates in the Name table? TealWren
 
Thank you for answering.

I am using Database Desktop that comes with Delphi installation. Paradox I think.

No, I am not joining tables. Just reading data and adding into the same table, screening through duplicate session numbers first.

Yes, I made sure there are no duplications in the table. The check was done before adding in the data. The first entry is entered, and chokes the next time around.
 
Does the problem happen every time?

Are you using TQuery components or TTables? If TQuery, what is your select statement? TealWren
 
Thank you for taking the time to reply.

I have solved the problem. It was in my algorithm. I was checking for a duplicate, whereas the SQL call which checks for many fields, actually did find multiple rows. I had to change the params to compare. It was now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top