كيفية عرض رسالة خطأ SQL في معاملة DBX في دلفي؟

StackOverflow https://stackoverflow.com/questions/9504864

  •  14-11-2019
  •  | 
  •  

سؤال

رأيت هذا في مكان ما منذ بعض الوقت، لكنني لم أستطع العثور عليه الآن.

أتذكر أن أحد أحداث الخطأ في بعض المكونات (tsqldataset، tdatasetprovider، tclientdataset أو غير ذلك سيعطيني رسالة الخطأ كما هو إرجاعها بواسطة خادم قاعدة البيانات نفسه، لكنني لا أستطيع أن أذكرها.

هل يعرف شخص ما ما أتحدث عنه؟

شكرا مقدما.

هل كانت مفيدة؟

المحلول

TClientDataSet.OnReconcileError contains a parameter of type EReconcileError which includes the error message, context and code. This data contains the message from the database server.

نصائح أخرى

Of course EReconcileError only helps if that is the particular type of database error you have. For all errors first look at the E.Messaage string, which gives you a description of the problem. Not always the same as the exact server text i think - it dpends also which database driver you are using - I am more familiar with the TMySQLConnection, but it's still a DBExpress driver... Chris

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top