漂
漂流的雲
Unregistered / Unconfirmed
GUEST, unregistred user!
SQL數據庫<br>用dbgrid做錄入。<br>edit1.跟edit2分別是單別,單號,但不在dbgrid裡錄入,dbgrid只錄入CE003,CE004,CE005.如何一次性保存所有dbgrid裡的內容<br>CE001 CE002 CE003 CE004 CE005<br>101 070801 0001 A 12<br>101 070801 0002 B 12<br>101 070801 0003 A 12<br><br>下面是的語句只能保存dbgrid選擇的數據,多條記錄不能同時保存<br><br>procedure TForm1.BitBtn1Click(Sender: TObject);<br>begin<br>with adoquery1 do<br>begin<br> close;<br> sql.clear;<br> sql.add('insert into XDSCE (CE001,CE002,CE003,CE004,CE005) values( '''+Edit1.text+''','''+edit2.text+''','''+DBGridEH1.DataSource.DataSet.FieldByName('CE003').Text+''', ');<br> sql.add(' '''+DBGridEH1.DataSource.DataSet.FieldByName('CE004').Text+''','''+DBGridEH1.DataSource.DataSet.FieldByName('CE005').Text+''')');<br> execsql;<br>end;<br>end;