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

如何檢查Access的表單裡是否有東西

答題得分者是:老大仔
egghead253
一般會員


發表:25
回覆:13
積分:7
註冊:2009-05-01

發送簡訊給我
#1 引用回覆 回覆 發表時間:2010-01-04 22:53:02 IP:219.84.xxx.xxx 訂閱
如何判斷Access的表單是否有內容?

ADO元件可以作到嗎?
老大仔
尊榮會員


發表:78
回覆:837
積分:1088
註冊:2006-07-06

發送簡訊給我
#2 引用回覆 回覆 發表時間:2010-01-05 06:50:34 IP:59.120.xxx.xxx 未訂閱
內容??
指的是筆數嗎??
在ADOQuery下完Select指令後
以以下判斷是否有資料即可:

if ADOQuery1.RecordCount > 0 then

christie
資深會員


發表:30
回覆:299
積分:475
註冊:2005-03-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2010-03-30 15:25:53 IP:60.249.xxx.xxx 未訂閱
//  Create a new project and
// add a TADOConnection (ADOConnection1), a TButton (Button1)
// ConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=XMain.mdb;Persist Security Info=False'
unit RTV_TABu;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
Button1: TButton;

procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation

{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
rs:TADODataSet;
begin
caption:='';
// Get the Database Schema Information (Tables / Views)
//
rs := TADODataSet.Create(Self);
ADOConnection1.OpenSchema(siTables,EmptyParam,EmptyParam, rs);
//
// Field 0 contains the Database Name - ignore.
// Field 1 contains the Schema No - ignore.
//
while not rs.Eof do
begin
//if Pos('SYSTEM', UpperCase(rs.Fields[3].Value)) = 0 then
if rs.Fields[3].Value='TABLE' then
caption:=caption rs.Fields[2].AsString ' / ';//ShowMessage(rs.Fields[2].AsString)
rs.Next;
end;
rs.Close;
rs.Free;
end;
end.

------
What do we live for if not to make life less difficult for each other?
系統時間:2024-04-26 14:16:49
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!