国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
delphi給access數(shù)據(jù)庫創(chuàng)建新表的方法

ADOQ1.SQL.Text:='CREATE   TABLE   BookTable   '
              +'(No1   COUNTER   PRIMARY   KEY,'
              +'ItemName1   TEXT,TreeNo1   INTEGER,HasParent1   BIT,'
              +'ParentNo1   INTEGER,ItemType1   INTEGER,ItemText1   IMAGE,'
              +'ItemAttr1   IMAGE,ADDTime1   DATETIME)';
{ 注釋:'BookTable'是表名 }
{ 'No1   COUNTER   PRIMARY   KEY'的意思是創(chuàng)建一個(gè)叫:'No1'的鍵,'PRIMARY   KEY'是將其}
{ 設(shè)置為主鍵,'COUNTER'是自動(dòng)編號 }
{ 'TreeNo1   INTEGER'是創(chuàng)建一個(gè)叫'TreeNo1'的'INTEGER'整數(shù)型鍵 }
{ 'ItemName1   TEXT'是創(chuàng)建一個(gè)叫'ItemName1'的'TEXT'字符型鍵 }
{ 'HasParent1   BIT'是創(chuàng)建一個(gè)叫'HasParent1'的'BIT'布爾型鍵 }
{ 以下省略鍵名解釋直接解釋類型 }
{ 'IMAGE'是OLE類型可存儲任何東西圖片,文件,流 }
{ 'DATETIME'是時(shí)間類型 }

unit   Unit1;

interface    
uses
      Windows,   Messages,   SysUtils,   Variants,   Classes,   comobj,adox_tlb,Graphics, Controls,   Forms,
      Dialogs,   StdCtrls;
  
type
      TForm1   =   class(TForm)
          Button1:   TButton;
          Edit1:   TEdit;
          Edit2:   TEdit;
          procedure   Button1Click(Sender:   TObject);
      private
          {   Private   declarations   }
      public
          {   Public   declarations   }
      end;
  
var
      Form1:   TForm1;
  
implementation
  
{$R   *.dfm}
  
procedure   TForm1.Button1Click(Sender:   TObject);
var
      Catalog:   _Catalog;
      Table:   _Table;
      Index   :   _Index;
      //FKey   :   _key;
      strCon:string;//定義連接字符串
      yourname:string;
      yourpwd:string;
begin
          yourname:=trim(edit1.Text);
          yourpwd:=trim(edit2.text);
          Catalog   :=   CoCatalog.Create;
          strCon   :=   'Provider=Microsoft.Jet.OleDB.4.0;'
          //通過Jet   OleDb直接操作Access數(shù)據(jù)庫
          +'Data   Source=c:\windows\desktop\'+yourname+'.mdb;'
          //數(shù)據(jù)庫位置
          +'Jet   OLEDB:Engine   Type=5;'
          //Jet   4.x格式,如為4,則Jet   3.x格式
          +'Locale   Identifier=0x0804;'
            //支持簡體中文(一定要有)
          +'Jet   OLEDB:Database   Password='+yourpwd;//修改密碼也在此;
          //加入密碼
          Catalog.Create(strCon);   //建立數(shù)據(jù)庫
          {建立數(shù)據(jù)表和索引}
          Catalog.Set_ActiveConnection(strCon);
          //連接到數(shù)據(jù)庫
          with   Catalog   do
          begin   //建立數(shù)據(jù)表
          Table:=   CoTable.Create();   //建立Table實(shí)例
          with   Table   do
          begin
          Name   :=   'MyTable1';         //建表   MyTable1
          Table.ParentCatalog   :=   Catalog   ;
          Columns.Append('ID',adInteger,8);           
          Columns.Item['ID'].Properties.Item['AutoIncrement'].Value   :=   true;            
          Columns.Append('Name',adVarWChar,40);
          Columns.Append('Parent_ID',adInteger,8);
          Columns.Item['Parent_ID'].Properties['Default'].Value   :=   0;                                                                       
          Columns.Append('Sort_ID',adInteger,8);
          Columns.Append('Counter',adInteger,8);
          Columns.Item['Counter'].Properties.Item['Default'].Value   :=   0;
  
          //數(shù)據(jù)類型詳見MDAC   SDK
          Tables.Append(Table);     //建表   MyTable1
          Index   :=   CoIndex.Create()   as   _Index;   //建立索引
          with   Index   do
          begin
          Name:='Idx1';
          PrimaryKey   :=   True   ;
          Unique   :=   True;
          Columns.Append('ID',adInteger,8);
          _Release;
          end;
          Table.Indexes.Append(Index,EmptyParam);  
          Table._Release;
          Table:=   CoTable.Create();  
          end;                       //with   table   do
          end;                       //with   catalog   do
     end;    
end.
//在DELPHI里動(dòng)態(tài)創(chuàng)建一個(gè)access表
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('create table tmp_rece( 學(xué)號 char(20),姓名 char(20),班級 char(20),dat datetime)');
adoquery1.execsql;
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from tmp_rece');
adoquery1.Open;

本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
如何使用 ADOX 通過主鍵創(chuàng)建表
C# 動(dòng)態(tài)創(chuàng)建Access數(shù)據(jù)庫及表
用VB動(dòng)態(tài)創(chuàng)建Access數(shù)據(jù)庫簡例
C#程序中:access數(shù)據(jù)庫中如何新建數(shù)據(jù)表
Delphi之通過ADOX操作access數(shù)據(jù)庫
Delphi多線程下的ADO編程
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服