请教怎样创建一个dbf表,并创建两个字段,并向其中添加记录,还有如何判断这张表已经存在,并清空记录

解决方案 »

  1.   

    var
      sTableList: TStrings;
    begin
      sTableList:=TStringList.Create();
      try
        adoConnection.Connected:=true;
        adoConnection.GetTableNames(sTableList,false);
        ShowMessage(sTableList.Text);//显示所有表名
    查找表名
      

  2.   

    创建:create table qq1 (bb c(10),bb1 n)
    添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2)
    如何判断这张表已经存在:
    var
      sTableList: TStrings;
    begin
      sTableList:=TStringList.Create();
      try
        adoConnection.Connected:=true;
        adoConnection.GetTableNames(sTableList,false);
        ShowMessage(sTableList.Text);//显示所有表名
    for i:=0 to flist.count-1 do
    if 表名=你的表名 THEN 已存在
      

  3.   

    创建:create table qq1 (bb c(10),bb1 n)
    添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2)
    如何判断这张表已经存在:
    var
      sTableList: TStrings;
    begin
      sTableList:=TStringList.Create();
      try
        adoConnection.Connected:=true;
        adoConnection.GetTableNames(sTableList,false);
        ShowMessage(sTableList.Text);//显示所有表名
    for i:=0 to flist.count-1 do
    if 表名=你的表名 THEN 已存在
      

  4.   

    创建:create table qq1 (bb c(10),bb1 n)
    添加记录:INSERT INTO TABLENAME(FIELD1,FIELD2) VALUES(1,2)
    如何判断这张表已经存在:
    var
      sTableList: TStrings;
    begin
      sTableList:=TStringList.Create();
      try
        adoConnection.Connected:=true;
        adoConnection.GetTableNames(sTableList,false);
        ShowMessage(sTableList.Text);//显示所有表名
    for i:=0 to flist.count-1 do
    if 表名=你的表名 THEN 已存在
      

  5.   

    with ADOquery do
    begin 
      close;
      sql.clear;
      sql.add('crate table 表名(id smallint)');
      execsql;
    end;  with ADOQuery1 do
      begin
        Close;
        SQL.Clear;
        SQL.Add('alter table 表名 add (ssss varchar(20) null)');
        try
          ExecSQL;
        except
          ShowMessage('错误');
        end;
      end;
      

  6.   

    IF EXISTS (SELECT name 
       FROM   sysobjects 
       WHERE  name = 'tablename' AND type = 'U')
    DELETE FROM 'tablename'
    GO
      

  7.   

    query1.sql.add('delete from table1 where condition');
    query1.sql.execsql;