線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:735
推到 Plurk!
推到 Facebook!

有關於timer和database的問題

缺席
Teresa_Chang
一般會員


發表:41
回覆:42
積分:16
註冊:2004-05-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-05-18 00:32:52 IP:140.111.xxx.xxx 未訂閱
以下是我timer內的程式 void __fastcall TForm2::Timer1Timer(TObject *Sender) { mSend->Text = count; String Temp; String id,x,y; char inbuff[1024]; DWORD nBytesRead, dwEvent, dwError; COMSTAT cs; ClearCommError(hComm,&dwError,&cs); if (cs.cbInQue > sizeof(inbuff)) { PurgeComm(hComm, PURGE_RXCLEAR); return; } ReadFile(hComm, inbuff,cs.cbInQue,&nBytesRead,NULL); inbuff[cs.cbInQue]= '\0'; mReceive->Text = inbuff; if(count==0) { count = count 1; id = mReceive->Text; } else if(count==1) { count = count 1; x = mReceive->Text; } else if(count==2) { count = count 1; y = mReceive->Text; } else { count = 0; Query1->Close(); Query1->SQL->Clear(); Query1->SQL->Add("insert into location (ID,X_coordinate,Y_coordinate)"); Query1->SQL->Add("values ('" id "','" x "','" y "')"); Query1->ExecSQL(); Query1->Close(); Query1->SQL->Clear(); Query1->SQL->Text = "select *from location"; Query1->Open(); } } 但是在 Query1->Close(); Query1->SQL->Clear(); Query1->SQL->Text = "select *from location"; Query1->Open(); 這部分就會有問題 另外,如果我把這個Form->Hide();以後, 這個timer還會繼續執行嗎?
timhuang
尊榮會員


發表:78
回覆:1815
積分:1608
註冊:2002-07-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-05-19 19:15:40 IP:203.95.xxx.xxx 未訂閱
hi, 請問你所謂有問題是什麼錯誤訊息呢? 關於 timer 的部分, 即使 form hide 起來後, 仍可以正常工作的!
系統時間:2024-04-30 0:41:40
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!