TClientDataSet - First record show twice

Doum

Member²
First of all, I develop in Delphi 4 with DOA ver. 3.4.6.4. I've connect my TOracleDataSet to a TDataSetProvider (Midas) wich is connect to a TClientDataSet (Midas). When I load my records in a DbGrid, the first record show twice. It's not a grid problem, because the recordcount as 1 record upper than my TOracleDataSet. If I connect my TOracleDataSet to my grid without the provider and the clientdataset, I've no problems at all.

Anyone has an answer?!
Thanks
 
These problems can occur you you have not correctly setup the key fields. Is this a simple query or a join query?
 
Sorry, but I don't understand what you intend to be "key fields"? It's probably my poor english (I'm french-canadian).
My query is very simple :

select '0' IGNORED,
t.CodeFournisseur,
t.eventtype,
substr(t.pid,instr(t.pid,'|',1,3)+1,(instr(t.pid,'^',1,1) - (instr(t.pid,'|',1,3)+1))) Dossier,
substr(t.pv1,instr(t.pv1,'|',1,19)+1,(instr(t.pv1,'|',1,20) - (instr(t.pv1,'|',1,19)+1))) NoAdm,
substr(t.pv1,instr(t.pv1,'|',1,20)+1,(instr(t.pv1,'|',1,21) - (instr(t.pv1,'|',1,20)+1))) RespPaiemCode,
t.refreceptevent,
t.statuttraitement,
t.dthrstatuttraitement,
t.origine,
t.pid,
t.pv1,
t.messageerreur,
t.precisionerreur
from cb1000.hl7treceptevent t
where to_char(t.dthrstatuttraitement,'yyyymmdd') = to_char(:pDate,'yyyymmdd')
and t.statuttraitement = 'ERREUR'
order by t.eventtype,
t.refreceptevent

If I connect my TOracleDataSet directly with the DbGrid, It's OK, but with a TClientDataSet beetween, the first record show twice.

Thanks
 
Okay. Did you perhaps override this key by setting TOracleDataSet.UniqueFields or by setting the pfInKey flag for one or more TOracleDataSet fields?
 
I have change nothing from the standard configuration as you can see. What surprise me the most, is this work without the TClientDataSet... Could be the MIDAS component you
cause the problem.? But with a TQuery (Delphi) it's ok... I really don't know where to search..

object q_ora_DetailErr: TOracleDataSet
SQL.Strings = (
'select '#39'0'#39' IGNORED,'
't.CodeFournisseur,'
't.eventtype,'

'substr(t.pid,instr(t.pid,'#39'|'#39',1,3)+1,(instr(t.pid,'#39'^'#39',1,1) - (ins' +
'tr(t.pid,'#39'|'#39',1,3)+1))) Dossier,'

'substr(t.pv1,instr(t.pv1,'#39'|'#39',1,19)+1,(instr(t.pv1,'#39'|'#39',1,20) - (i' +
'nstr(t.pv1,'#39'|'#39',1,19)+1))) NoAdm,'

'substr(t.pv1,instr(t.pv1,'#39'|'#39',1,20)+1,(instr(t.pv1,'#39'|'#39',1,21) - (i' +
'nstr(t.pv1,'#39'|'#39',1,20)+1))) RespPaiemCode,'
't.refreceptevent,'
't.statuttraitement,'
't.dthrstatuttraitement,'
't.origine,'
't.pid,'
't.pv1,'
't.messageerreur,'
't.precisionerreur'
'from cb1000.hl7treceptevent t'

'where to_char(t.dthrstatuttraitement,'#39'yyyymmdd'#39') = to_char(:pDat' +
'e,'#39'yyyymmdd'#39')'
'and t.statuttraitement = '#39'ERREUR'#39
'order by t.eventtype,'
' t.refreceptevent'
''
' '
' '
' '
' '
' ')
ReadBuffer = 25
Optimize = True
Debug = False
Variables.Data = {0300000001000000060000003A50444154450C0000000000000000000000}
StringFieldsOnly = False
SequenceField.ApplyMoment = amOnPost
OracleDictionary.EnforceConstraints = False
OracleDictionary.UseMessageTable = False
OracleDictionary.DefaultValues = False
OracleDictionary.DynamicDefaults = False
OracleDictionary.FieldKinds = False
OracleDictionary.DisplayFormats = False
OracleDictionary.RangeValues = False
OracleDictionary.RequiredFields = True
QBEDefinition.SaveQBEValues = True
QBEDefinition.AllowFileWildCards = True
QBEDefinition.QBEFontColor = clNone
QBEDefinition.QBEBackgroundColor = clNone
QBEDefinition.QBEFieldDefs = {
030000000E0000000700000049474E4F52454401000000000F000000434F4445
464F55524E4953534555520100000000090000004556454E5454595045010000
000007000000444F53534945520100000000050000004E4F41444D0100000000
0D00000052455350504149454D434F444501000000000E000000524546524543
4550544556454E540100000000100000005354415455545452414954454D454E
54010000000014000000445448525354415455545452414954454D454E540100
000000070000004F524947494E45010000000003000000504944010000000003
00000050563101000000000D0000004D45535341474545525245555201000000
000F000000505245434953494F4E4552524555520100000000}
Cursor = crHourGlass
ReadOnly = False
LockingMode = lmCheckImmediate
QueryAllRecords = True
CountAllRecords = False
RefreshOptions = []
CommitOnPost = False
CachedUpdates = False
QBEMode = False
Session = oraSession
DesignActivation = False
Active = False
Left = 616
Top = 40
object q_ora_DetailErrIGNORED: TStringField
FieldName = 'IGNORED'
Size = 1
end
object q_ora_DetailErrCODEFOURNISSEUR: TStringField
FieldName = 'CODEFOURNISSEUR'
Size = 3
end
object q_ora_DetailErrEVENTTYPE: TStringField
FieldName = 'EVENTTYPE'
Size = 3
end
object q_ora_DetailErrDOSSIER: TMemoField
FieldName = 'DOSSIER'
BlobType = ftMemo
Size = 2000
end
object q_ora_DetailErrNOADM: TMemoField
FieldName = 'NOADM'
BlobType = ftMemo
Size = 2000
end
object q_ora_DetailErrRESPPAIEMCODE: TMemoField
FieldName = 'RESPPAIEMCODE'
BlobType = ftMemo
Size = 2000
end
object q_ora_DetailErrREFRECEPTEVENT: TFloatField
FieldName = 'REFRECEPTEVENT'
Required = True
end
object q_ora_DetailErrSTATUTTRAITEMENT: TStringField
FieldName = 'STATUTTRAITEMENT'
Size = 7
end
object q_ora_DetailErrDTHRSTATUTTRAITEMENT: TDateTimeField
FieldName = 'DTHRSTATUTTRAITEMENT'
end
object q_ora_DetailErrORIGINE: TStringField
FieldName = 'ORIGINE'
Size = 50
end
object q_ora_DetailErrPID: TMemoField
FieldName = 'PID'
BlobType = ftMemo
Size = 2000
end
object q_ora_DetailErrPV1: TMemoField
FieldName = 'PV1'
BlobType = ftMemo
Size = 2000
end
object q_ora_DetailErrMESSAGEERREUR: TMemoField
FieldName = 'MESSAGEERREUR'
BlobType = ftMemo
Size = 2000
end
object q_ora_DetailErrPRECISIONERREUR: TMemoField
FieldName = 'PRECISIONERREUR'
BlobType = ftMemo
Size = 2000
end
end
 
I've compile with Delphi7 with DOA for Delphi7 et the problem is gone!!
Probably a problem with the midas component in Delphi4
 
Back
Top