I am coding with the ADO are:
qryCusType.post try;
except
on E: EDatabaseError do
if qryCusType.Connection.Errors [0]. NativeError = 2627 then begin / / Key violation (key already exists).
with editTypeName do begin Show; SetFocus; end;
raise (exception.create ('Type Name must be unique'));
end else if frmKaifa.ADOConnection1.Errors [0]. NativeError = 32 then raise (exception.create ('Unable to insert or update Customer Type ...' + # 13 + 'It has been changed or deleted since last retrieved') )
else raise;
end;
what if I use UNIDAC?
thanks
caksul
convert ADO to UNIDAC
-
AndreyZ
Hello,
You can use the following code:Please note that to use the EMSError class, you should add the OLEDBAccessUni unit to the USES clause of your unit.
You can use the following code:
Code: Select all
procedure TMainForm.BitBtnClick(Sender: TObject);
var
er: EMSError;
begin
try
UniQuery.Post;
except
on E: EUniError do begin
er := EMSError(E.InnerError);
if er.MSSQLErrorCode = 2627 then
// your code
end;
end;
end;thanks
AndreyZ wrote:Hello,
You can use the following code:Please note that to use the EMSError class, you should add the OLEDBAccessUni unit to the USES clause of your unit.Code: Select all
procedure TMainForm.BitBtnClick(Sender: TObject); var er: EMSError; begin try UniQuery.Post; except on E: EUniError do begin er := EMSError(E.InnerError); if er.MSSQLErrorCode = 2627 then // your code end; end; end;
thanks
http://www.devart.com/forums/viewtopic.php?t=23859
http://www.devart.com/forums/viewtopic.php?t=23859
AndreyZ wrote:Feel free to contact us if you have any further questions about UniDAC.