Query1.Close;
  Query1.Sql.Clear;
  Query1.Sql.Text:='create table yourtablename(id integer)';
  Query1.ExecSql;

解决方案 »

  1.   

    对了,你要在query1.databasename,或database中指定要在那个数据库建表
      

  2.   

       ADOConnection1.Execute('create table yourtablename(id integer)');
    不用query 也可
    开始菜单delphi-> help->bde->locate sql 
    对本地表的sql说的比较请促
      

  3.   

    Creates a table.CREATE TABLE table_reference (column_definition [, column_definition,...] [, primary_key_constraint])DescriptionUse 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 s.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 tablesIf 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 s.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 s 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))
      

  4.   

    怎么看起来象server中建表一样
      

  5.   

    但是运行时出错:invalid use of keyword;taken?xingming?  why???
    with query1 do begin
      sql.Clear;
      sql.Add('create table "mytable1.db"(xuehao:integer,xingming:string)');
      execsql;
      end ;
      

  6.   

    老鬼,你好!我用的是access的数据库,怎样在source.mdb库文件建立一个“表1”呀!写细一点,我是初学者能告诉我你的qq吗
      

  7.   

    sql.Add('create table "mytable1.db"(xuehao:integer,xingming:string)');
    首先表名可以不用加"",我从来就没加。
    第二不用加 :号
    第三应该没有string型吧?改为varchar(20)之类!
    你是什么数据库?
    create table TableStu (Index integer,Name varchar(20)); 
    //我估计主要试你的类型出错。这些类型鱼你数据库有关!
      

  8.   

    to : grace009(liu) ]
    qry.Sql.Add('create table "mytable1.db"(xuehao integer,xingming  char(10))');
    是正确的
    (xuehao:integer,xingming:string)');
    不合sql 规范 那是delphi 的语法
    sql 是由数据库区执行的
      
      

  9.   

    好吧:我试一下,我用的是parax表。
      

  10.   

    to lqfwll(xiaolong) 
    如果你用bde 
    先用dababase 连接到你的数据库(source.mdb);
    query1.batabasename=dababase 的batabasename
    with query1 do
    begin
      close;
      sql.Clear;
      sql.Add('create table 表1(xuehao integer,xingming char(10))');
      execsql;
    end ; 
    如果用ado 也差不多关键看类型要access支持
    qq 16211043