ما الخطأ في كود لحفظ البيانات من ثلاث StringGrid ؟
#1
Question 
السلام عليكم
جربت حفظ البيانات من ثلاث StringGrid و انا كمبتدء اجتهدت و جربت لكن النتائج جاءت غير ما اردت 
حيث انه كرر الحفظ عدة مرات...
كيف اجعله يحفظ في حالة كان في StringGrid1 و في StringGrid2 و في StringGrid3 او في احدها فقط 
لكم مني كل الشكر و التقدير و ثقتي فيكم كبيره في شرح الخطأ و التصويب
كود :
procedure TForm6.Button2Click(Sender: TObject); Var D,DF:String[13]; I,S,K:Integer; begin D:=QuotedStr(DbEdit16.Text); DF:=QuotedStr('yyyy-mm-dd');  If (DbEdit1.Text<>'')And(StringGrid1.rowcount>2) or(StringGrid2.rowcount>2) or      (StringGrid3.rowcount>2) Then begin   For i:=1 to StringGrid1.rowcount-2  Do   For s:=1 to StringGrid2.rowcount-2  Do   for k:=1 to StringGrid3.rowcount-2  Do              With ADOQuery8 Do  Begin Close; SQL.Clear; SQL.Add('Insert Into Zpatient Values(To_date('+d+','+DF+'),'+DBEdit1.Text+', '); SQL.Add(''+StringGrid1.Cells[0,i]+','+quotedstr(StringGrid3.Cells[0,k])+','); SQL.Add(''+StringGrid2.Cells[0,s]+','+DbEdit12.Text+','); SQL.Add(''+quotedstr(StringGrid2.Cells[2,s])+','+quotedstr(StringGrid1.Cells[2,i])+','); SQL.Add(''+DbEdit13.Text+')'); ExecSQL; End; end; ShowMessage('That is OK'); StringGrid1.Cells[0,i]:=''; StringGrid1.Cells[1,i]:=''; StringGrid1.Cells[2,i]:=''; StringGrid2.Cells[0,s]:=''; StringGrid2.Cells[1,s]:=''; StringGrid2.Cells[2,s]:=''; StringGrid3.Cells[0,k]:=''; end; end.
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم