BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Weird Access posting problem - any clues?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases
View previous topic :: View next topic  
Author Message
Mark Edwards
Guest





PostPosted: Fri Aug 19, 2005 9:11 pm    Post subject: Weird Access posting problem - any clues? Reply with quote





I am seeing a weird posting problem. I'd be interested in seeing some
opinions on what causes it, and why this seems to fix it.

Basically, I am updating fields in the Sessions table. Basically, I
open the dataset, put it into insert mode, call a subroutine to fill
the persistent fields, then attempt to post the records.

Without the sleep statement, I get random failures saying:

[Microsoft][ODBC Microsoft Access Driver] The changes you requested to
the table were not successful because they would create duplicate
values in the index, primary key, or relationship. Change the data in
the field or fields that contain duplicate data, remove the index, or
redefine the index to permit duplicate entries and try again.

With the sleep statement (or any delay, like a ShowMessage command), I
don't have any failures, and everything posts just fine. Any clues?


Thanks,
Mark Edwards

=========================
// Open and set into Insert Mode
DM1.dsSessions.Open;
DM1.dsSessions.Insert;

// Build/Initialize Session Record
FillSessions;

try
sleep(1000); // weird - this seems to stop posting errors
DM1.dsSessions.Post;
except
on E: Exception do
ShowMessage('SESSIONS ERROR: [' + E.Message + ']');
end;
=========================

The FillSessions subroutine looks something like this:
=========================
begin
// Clear Fields
DM1.dsSessions.Clearfields;

// Build Record
DM1.dsSessionsSysMID := vSysMID;
DM1.dsSessionsSessionID := vSessID;
DM1.dsSessionsOpenDT.AsDateTime := (Now);
DM1.dsSessionsStatus.Value := 'Private';
DM1.dsSessionsDescript.Value := 'Private Network Session';

DM1.dsSessionsNetMID.AsGUID := vNetMID;
DM1.dsSessionsLMeth.Value := 'Network Controlled';
DM1.dsSessionsLTypeEq.Value := DM1.dsSessionsLMeth.Value;
DM1.dsSessionsEquipMID := vEquipMID;
DM1.dsSessionsRemarks.Value := 'Automatic: System Generated
Session';
DM1.dsSessionsCTRL.AsString := '[F3]';
end;

=========================
Back to top
Django Dunn
Guest





PostPosted: Mon Aug 22, 2005 5:56 am    Post subject: Re: Weird Access posting problem - any clues? Reply with quote



On Fri, 19 Aug 2005 16:11:01 -0500, Mark Edwards wrote:

Quote:
[Microsoft][ODBC Microsoft Access Driver] The changes you requested to
the table were not successful because they would create duplicate
values in the index, primary key, or relationship. Change the data in
the field or fields that contain duplicate data, remove the index, or
redefine the index to permit duplicate entries and try again.

Hi Mark,

What is the primary key of your table? I see you have a field
dsSeesionOpenDT that you are populating with the results of the Now
function. If your program is running on anything more powerful than a 286
you'll probably get at least 10 records posting per second - hopefully many
more than that. If that's the issue that's why your sleep command is
allowing the function to work.

You might try using an AutoInc field within your primary key or at least
supply an integer field that you populate yourself with an incrementing
number. That will guarantee the uniqueness of each record without much
overhead.

HTH,

Django

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.