delphi4arab منتديات دلفي للعرب

نسخة كاملة : خطأ عند استخدام Parameters.ParamByName
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم ورحمة الله
خطأ عند استخدام Parameters.ParamByName في دلفي 7 مع ado
حيث أني لما انفذ
كود :
With qry1 do begin Close; SQL.Clear; SQL.Add('select * where NOM=:d1'); Parameters.ParamByName('d1').Value:=TBL.FieldByName('nom')AsStrinG; Open; end;
يظهر الخطأ
كود :
error (object parameter defini de manier inncorect, des information incoherantes ou incompletes ont ete fournies)
select * where NOM=:d1
يجب تحدد اسم الجدول يعني
select * From table where .......
بارك الله فيك أخي
أنا أعلم التعليمة كالتالي
كود :
With qry1 do begin Close; SQL.Clear; SQL.Add('select* from indice where cat=:d1') Parameters.ParamByName('d1').Value:=tbl.FieldByName('nom_fct').Value; Open; end;

لكن المشكلة في .value
ربما
بارك الله فيك
كود :
With qry1 do begin Close; SQL.Clear; SQL.Add('select * where NOM=:d1'); parameters.ParamByName('d1').DataType:=ftWideString; Parameters.ParamByName('d1').Value:=TBL.FieldByName('nom').AsStrinG; Open; end;


تفظل أخي هذا هو الحل لمشكلتك
قد يكون السبب هو عدم تماثل نوع البيانات مثلما رد الاخ آنفا
وقد يكون السبب هو ان قيمة الحقل في الجدول غير محددة
nill / null

جرب فحص الحقل والتأكد ن ان القيمة التي فيه صحيحة
if "the field is not null" then assign the data values to the parameter
إقتباس :
كود :
parameters.ParamByName('d1').DataType:=ftWideString;
أيضا اضبط Type (تحت Value) على نمط البيانات للـ Parameter من Object Inspector