Problem using TADOStoredProc with MS Access XP



My TADOStoredProc is executing the first parameter values when I call it
subsequent times. For excample say I pass an integer value of 6 and the
next time I call it, I pass 5. It inserts 6 again.

I have the following query written in Access:
======================================================================
PARAMETERS pEmployeeID Long,
pDefaultDay Text ( 20 ),
pShiftID Long,
pStartTime DateTime,
pEndTime DateTime;
INSERT INTO Emp_Defaults ( EmployeeID, DefaultDay, ShiftID, StartTime,
EndTime )
VALUES (pEmployeeID, pDefaultDay, pShiftID, pStartTime, pEndTime);
======================================================================
I have the following code in Delphi:
======================================================================
//now add the default times
if (Self.chbxMonday.Checked) then
InsertDtl(iNewHireID,'Monday',cbxShftsMon.EditValue,StartTimeMon.Time,EndTimeMon.Time);

if (Self.chbxTues.Checked) then
InsertDtl(iNewHireID,'Tuesday',cbxShftsTues.EditValue,StartTimeTues.Time,EndTimeTues.Time);
//
...
if (Self.chbxSun.Checked) then
InsertDtl(iNewHireID,'Sunday',cbxShftsSun.EditValue,StartTimeSun.Time,EndTimeSun.Time);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TfrmNewHire.InsertDtl(const EmpID: Integer; const DefDay: string;
const ShftID: Integer; const StTime, EndTime: TTime);
begin
with spInsertDefShifts do
begin
Parameters[0].Value := EmpID;
Parameters[1].Value := DefDay;
Parameters[2].Value := ShftID;
Parameters[3].Value := StTime;
Parameters[4].Value := EndTime;
ExecProc;
end;
end;
======================================================================
The TADOStoredProc is defined as :
---------------------------------------------------------------------------------------------------------
object spInsertDefShifts: TADOStoredProc
ProcedureName = 'qryInsertDefShifts'
Parameters = <
item
Name = 'pEmployeeID'
DataType = ftInteger
Size = 8
Value = Null
end
item
Name = 'pDefaultDay'
DataType = ftString
Size = 20
Value = Null
end
item
Name = 'pShiftID'
DataType = ftInteger
Size = 8
Value = Null
end
item
Name = 'pStartTime'
DataType = ftDateTime
Size = 8
Value = Null
end
item
Name = 'pEndTime'
DataType = ftDateTime
Size = 8
Value = Null
end>
Left = 556
Top = 184
end
---------------------------------------------------------------------------------------------------------
Am I missing something? Anyone know why the procedure continues to hold the
parameter values from the first time it is called?

Thanks,
Bill N


.



Relevant Pages

  • Re: Delphi 7 Ent. TADOStoredProc
    ... I would like to know why when I am using a TADOStoredProc the first time ... if _Cmd = nil then ... DataType:=ftInteger; ...
    (borland.public.delphi.database.ado)
  • Delphi 7 Ent. TADOStoredProc
    ... I would like to know why when I am using a TADOStoredProc the first time is work well but the next time i got this trace from the SQL profiler: ... if _Cmd = nil then ... DataType:=ftInteger; ...
    (borland.public.delphi.database.ado)
  • Re: IsNull bad?
    ... Below are quotes from BOL for ISNULL: ... Above clearly explains why ISNULL returns the datatype as the first parameter. ... So it seems like SQL Server walks the arguments from left to right and if implicit datatype ...
    (microsoft.public.sqlserver.programming)