Hi again,
Thanks for your interest.
SQL creating the view:-
SELECT PolicyPrdVeh.PolicyID, PolicyPrdVeh.StartDateTime,
PolicyPrdVeh.VehCode, PolicyPrdVeh.EndDateTime,
PolicyPrdVeh.ValTypeCode, PolicyPrdVeh.ValAgreed,
PolicyPrdVeh.UseMT, PolicyPrdVeh.UseSDH, PolicyPrdVeh.UsePubH,
PolicyPrdVeh.UsePrivH, PolicyPrdVeh.UseSDP, PolicyPrdVeh.UseC1,
PolicyPrdVeh.UseC2, PolicyPrdVeh.UseC3, PolicyPrdVeh.UseOGds,
PolicyPrdVeh.UseHaul, PolicyPrdVeh.TPExcess,
PolicyPrdVeh.FTDFlExcess, PolicyPrdVeh.AgeMin,
PolicyPrdVeh.Premium,
Vehicle.StartDate, Vehicle.RegMark,
Vehicle.MakeYear, Vehicle.Make, Vehicle.Model, Vehicle.Deriv,
Vehicle.MAM, Vehicle.ObjectCode
FROM PolicyPrdVeh INNER JOIN
Vehicle ON PolicyPrdVeh.VehCode = Vehicle.Code
WHERE (Vehicle.MAM > 3.5)
I should point out that the above is essentially what was generated by SQL
Server. My understanding is that it runs on the server and, as far as Delphi
is concerned, the TADODataSet is seeing a table - certainly .CommandType is
set to cmdTableDirect.
The original intention was that this was going to be a q&d solution to a
small temporary requirement - thus connecting a DBGrid to a table meant that
things like changing rows in the grid invoked the standard automatic Post,
without any extra work from me.
Where I *think* I've come unstuck is misunderstanding SQL Server's behaviour
when it tries to update the actual tables underlying the view. The key to
Vehicle rows is an auto-incremented integer (doesn't appear in the view) and
that value is also held in a column in PolicyPrdVeh - the colums in the two
tables are joined by a foreign key constraint.
I've assumed that I'd done enough that the value generated in the Vehicle
table (when the new row was inserted) was passed to the column in
PolicyPrdVeh when the new row was inserted in that table. However, as I said
in my first post, that this latter column doesn't have a value *seems* to be
what's generating the error.
As always, any help, pointers, etc. much appreciated.
Regards,
Stuart