如何新增一個Paradox table |
尚未結案
|
a120803
初階會員 ![]() ![]() 發表:61 回覆:66 積分:25 註冊:2003-03-12 發送簡訊給我 |
|
hagar
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
begin with TTable.Create(self) do begin DatabaseName := 'db'; TableName := 'TableA'; TableType := ttParadox; with FieldDefs do Begin Add('Age', ftInteger, 0, True); Add('Name', ftString, 25, False); Add('Weight', ftFloat, 0, False); End; IndexDefs.Add('MainIndex','IntField', [ixPrimary, ixUnique]); CreateTable; end; end;--- 每個人都是一本書 |
a120803
初階會員 ![]() ![]() 發表:61 回覆:66 積分:25 註冊:2003-03-12 發送簡訊給我 |
|
hagar
版主 ![]() ![]() ![]() ![]() ![]() ![]() 發表:143 回覆:4056 積分:4445 註冊:2002-04-14 發送簡訊給我 |
截自 Help 中的範例:
procedure TForm1.Button1Click(Sender: TObject); var i: Integer; begin Table1.Active := True; for i:= 1 to Table1.FieldDefs.Count - 1 do begin ListBox1.Items.Add(Table1.FieldDefs[i].Name); end; Table1.Active := False; end;--- 每個人都是一本書 |
Mickey
版主 ![]() ![]() ![]() ![]() ![]() 發表:77 回覆:1882 積分:1390 註冊:2002-12-11 發送簡訊給我 |
截自 LocalSQL.hlp
CREATE TABLE table_reference (column_definition [, column_definition,...] [, primary_key_constraint]) Description Use the CREATE TABLE statement to create a dBASE or Paradox table, define its columns, and define a primary key constraint. The table name reference for CREATE TABLE must comply with the rules described in the section on naming conventions. Table names with embedded spaces must be enclosed in quotation marks. Column definitions consist of a comma-separated list of combinations of column name, data type, and (if applicable) dimensions. The list of column definitions must be enclosed in parentheses. The number and type of dimensions that must be specified varies with column type. See the section on defining column types for specific syntax of all supported column types. Use the PRIMARY KEY (or CONSTRAINT) keyword to create a primary index for the new table.The following statement creates a Paradox table with a PRIMARY KEY constraint on the LAST_NAME and FIRST_NAME columns: CREATE TABLE "employee.db" ( Last_Name CHAR(20), First_Name CHAR(15), Salary NUMERIC(10,2), Dept_No SMALLINT, PRIMARY KEY (Last_Name, First_Name) ) An alternate syntax for creating a primary key constraint is using the CONSTRAINT keyword. While Paradox primary indexes do not have names, an arbitrary name needs to be provided to satisfy the CONSTRAINT keyword need for a token name. CREATE TABLE "employee.db" ( Last_Name CHAR(20), First_Name CHAR(15), Salary NUMERIC(10,2), Dept_No SMALLINT, CONSTRAINT z PRIMARY KEY (Last_Name, First_Name) ) Indicate whether the table is a Paradox or dBASE table by specifying the file extension when naming the table: ".DB" for Paradox tables ".DBF" for dBASE tables If you omit the file extension for a local table name, the table created is the table type specified in the Default Driver setting in the System INIT page of the BDE Administrator utility. When specifying a file extension, the table name reference for CREATE TABLE must be enclosed in quotation marks. Column definitions based on domains are not supported. Primary keys are the only form of constraint that can be defined with CREATE TABLE. Note To create a table with columns that have non-alphanumeric characters or spaces in the column name, you must enclose the column name in quotation marks and prefix the quoted column name with the table name in quotes (if the filename extension is included) or just the table name. Any one of the three variations below are acceptable. CREATE TABLE "abc.db" ( ID CHAR(3), "ABC.db"."Funny Name" CHAR(10) ) CREATE TABLE abc ( ID CHAR(3), ABC."Funny Name" CHAR(10) ) CREATE TABLE "abc.db" ( ID CHAR(3), ABC."Funny Name" CHAR(10) ) |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |