Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-10-2012, 03:02 PM
expresso expresso is offline
Junior Member
 
Join Date: May 2012
Posts: 3
Default multiple records expected but only one found

I have a delphi program with a form containing some dbedit objects.
The user of the form, enters some data and that data are saved in the database.

Whenever i press the save button on my form i get the message "multiple records expected but only one found".
After that, if i press the cancel button, the data are saved without any problem in the table!

The table in mssql is something like that:

field 1: id primary key (identity set to yes)
field 2: date primary key
....
various other fields.


The form is using a counter (controled by delphi code) and the current date (see field2). All the other fields are entered manually.

If i save the first data of the day (e.g 9/5/2012) i get no error message. When i save the second (date 9/5/2012 again) i get the error message.
If i change the date to 10/5/2012 i get no error! So, if the date is unique there is no error.

I don't really understand why that happens since date and id are combined to
create a unique primary key.

Any ideas?
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 07:58 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.