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

點解唔support?

答題得分者是:yachanga
BorlandUser
中階會員


發表:148
回覆:217
積分:73
註冊:2004-02-19

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-04-29 23:21:38 IP:218.102.xxx.xxx 未訂閱
CREATE TABLE User ( User_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, User_Name VARCHAR (50) NOT NULL, Login_ID CHAR (20) NOT NULL, Password CHAR (12) NOT NULL, Version INT UNSIGNED NOT NULL, Status TINYINT UNSIGNED NOT NULL, Added_Date DATETIME NOT NULL, Added_By INT UNSIGNED NOT NULL, Updated_Date DATETIME NOT NULL, Updated_By INT UNSIGNED NOT NULL, PRIMARY KEY (User_ID), INDEX (Login_ID) ); CREATE TABLE Customer ( Customer_ID INT UNSIGNED NOT NULL AUTO_INCREMENT, Customer_Code CHAR (5) BINARY NOT NULL, Customer_Name VARCHAR (50) NOT NULL, Customer_Address VARCHAR (100) NOT NULL, Contact_Tel VARCHAR (20) NOT NULL, Contact_Fax VARCHAR (20) NOT NULL, Contact_Email VARCHAR (50) NOT NULL, Version INT UNSIGNED NOT NULL, Status TINYINT UNSIGNED NOT NULL, Added_Date DATETIME NOT NULL, Added_By INT UNSIGNED NOT NULL, Updated_Date DATETIME NOT NULL, Updated_By INT UNSIGNED NOT NULL, PRIMARY KEY (Customer_ID), INDEX (Customer_Code) ); procedure TMainUserForm.Button1Click(Sender: TObject); var strSQL: String; begin strSQL := 'Select Customer.Added_By, Customer.Updated_By, User.User_Name From Customer, User Where Customer.Added_By = User.User_ID'; ShowMessage(strSQL); With SQLQuery Do Begin Close; SQL.Clear; SQL.Add(strSQL); Open; If (RecordCount = 1) Then ShowMessage('Success'); End; end; 我錯左那裏,不能執行,我用sqlquery架,它說operation not support??
yachanga
資深會員


發表:24
回覆:335
積分:296
註冊:2003-09-27

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-04-29 23:51:32 IP:61.230.xxx.xxx 未訂閱
Hi BorlandUser: 這個問題之前很多大大討論過 Recordcount 使用上有很多限制ㄝ 替代方案很多,可以改成如下表示:
strSQL := 'Select count(*) CNT From Customer, User Where Customer.Added_By = User.User_ID';    With SQLQuery Do
 Begin
  Close;
  SQL.Clear;
  SQL.Add(strSQL);
  Open;      If (FieldByName('CNT').asInteger = 1) Then
   ShowMessage('Success');
 END;
可參考如下Borland官方解釋 Question: Why am I getting the error 'Operation Not Supported' when calling TSQLQuery.RecordCount? This error may also be preceded by the exception'ORA-00942: table or view does not exist' in the IDE. Answer: You should note from the Delphi help that reading RecordCount will generate an exception if the dataset can not determine the number of records. Do not read RecordCount if: The dataset represents stored procedure. The dataset represents a query that contains parameters. The dataset represents a multi-table join. http://community.borland.com/article/0,1410,28494,00.html 發表人 - yachanga 於 2004/04/29 23:56:56
BorlandUser
中階會員


發表:148
回覆:217
積分:73
註冊:2004-02-19

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-04-29 23:56:20 IP:218.102.xxx.xxx 未訂閱
原來我話之前用不到alias都是因為這個原因... >_<
系統時間:2024-05-08 7:46:20
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!