| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> DELPHI zhong cao zuo ACCESS ji qiao
 

DELPHI zhong cao zuo ACCESS ji qiao

2008-05-18 23:55:19 编辑來源:互联网 评论
 
本文为【DELPHI中操作ACCESS技巧】的拼音翻译版
  1.DELPHI zhong cao zuo ACCESS shu ju ku ( jian li .mdb wen jian , ya suo shu ju ku )
  yi xia dai ma zai WIN2K,D6,MDAC2.6 xia ce shi tong guo ,
  bian yi hao de cheng xu zai WIN98 di er ban wu ACCESS huan jing xia yun xing cheng gong .
  // sheng ming lian jie zi fu chuan
  Const
  SConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;'
  +'Jet OLEDB:Database Password=%s;';
  //=============================================================================
  // Procedure: GetTempPathFileName
  // Author : ysai
  // Date : 2003-01-27
  // Arguments: (None)
  // Result : string
  //=============================================================================
  function GetTempPathFileName():string;
  // qu de lin shi wen jian ming
  var
  SPath,SFile:array [0..254] of char;
  begin
  GetTempPath(254,SPath);
  GetTempFileName(SPath,'~SM',0,SFile);
  result:=SFile;
  DeleteFile(result);
  end;
  //=============================================================================
  // Procedure: CreateAccessFile
  // Author : ysai
  // Date : 2003-01-27
  // Arguments: FileName:String;PassWord:string=''
  // Result : boolean
  //=============================================================================
  function CreateAccessFile(FileName:String;PassWord:string=''):boolean;
  // jian li Access wen jian , ru guo wen jian cun zai ze shi bai
  var
  STempFileName:string;
  vCatalog:OleVariant;
  begin
  STempFileName:=GetTempPathFileName;
  try
  vCatalog:=CreateOleObject('ADOX.Catalog');
  vCatalog.Create(format(SConnectionString,[STempFileName,PassWord]));
  result:=CopyFile(PChar(STempFileName),PChar(FileName),True);
  DeleteFile(STempFileName);
  except
  result:=false;
  end;
  end;
  //=============================================================================
  // Procedure: CompactDatabase
  // Author : ysai
  // Date : 2003-01-27
  // Arguments: AFileName,APassWord:string
  // Result : boolean
  //=============================================================================
  function CompactDatabase(AFileName,APassWord:string):boolean;
  // ya suo yu xiu fu shu ju ku , fu gai yuan wen jian
  var
  STempFileName:string;
  vJE:OleVariant;
  begin
  STempFileName:=GetTempPathFileName;
  try
  vJE:=CreateOleObject('JRO.JetEngine');
  vJE.CompactDatabase(format(SConnectionString,[AFileName,APassWord]),
  format(SConnectionString,[STempFileName,APassWord]));
  result:=CopyFile(PChar(STempFileName),PChar(AFileName),false);
  DeleteFile(STempFileName);
  except
  result:=false;
  end;
  end;
  ACCESS zhong shi yong SQL yu ju ying zhu yi de di fang ji ji dian ji qiao
  yi xia SQL yu ju zai ACCESS XP de cha xun zhong ce shi tong guo
  jian biao :
  Create Table Tab1 (
  ID Counter,
  Name string,
  Age integer,
  [Date] DateTime);
  ji qiao :
  zi zeng zi duan yong Counter sheng ming .
  zi duan ming wei guan jian zi de zi duan yong fang kuo hao [] kuo qi lai , shu zi zuo wei zi duan ming ye ke xing .
  jian li suo yin :
  xia mian de yu ju zai Tab1 de Date lie shang jian li ke chong fu suo yin
  Create Index iDate ON Tab1 ([Date]);
  wan cheng hou ACCESS zhong zi duan Date suo yin shu xing xian shi wei - you ( you chong fu ).
  xia mian de yu ju zai Tab1 de Name lie shang jian li bu ke chong fu suo yin
  Create Unique Index iName ON Tab1 (Name);
  wan cheng hou ACCESS zhong zi duan Name suo yin shu xing xian shi wei - you ( wu chong fu ).
  xia mian de yu ju shan chu gang cai jian li de liang ge suo yin
  Drop Index iDate ON Tab1;
  Drop Index iName ON Tab1;
  ACCESS yu SQLSERVER zhong de UPDATE yu ju dui bi :
  SQLSERVER zhong geng xin duo biao de UPDATE yu ju :
  UPDATE Tab1
  SET a.Name = b.Name
  FROM Tab1 a,Tab2 b
  WHERE a.ID = b.ID;
  tong yang gong neng de SQL yu ju zai ACCESS zhong ying gai shi
  UPDATE Tab1 a,Tab2 b
  SET a.Name = b.Name
  WHERE a.ID = b.ID;
  ji :ACCESS zhong de UPDATE yu ju mei you FROM zi ju , suo you yin yong de biao dou lie zai UPDATE guan jian zi hou .
  shang li zhong ru guo Tab2 ke yi bu shi yi ge biao , er shi yi ge cha xun , li :
  UPDATE Tab1 a,(Select ID,Name From Tab2) b
  SET a.Name = b.Name
  WHERE a.ID = b.ID;
  fang wen duo ge bu tong de ACCESS shu ju ku - zai SQL zhong shi yong In zi ju :
  Select a.*,b.* From Tab1 a,Tab2 b In 'db2.mdb' Where a.ID=b.ID;
  shang mian de SQL yu ju cha xun chu dang qian shu ju ku zhong Tab1 he db2.mdb( dang qian wen jian jia zhong ) zhong Tab2 yi ID wei guan lian de suo you ji lu .
  que dian - wai bu shu ju ku bu neng dai mi ma .
  zai ACCESS zhong fang wen qi ta ODBC shu ju yuan
  xia li zai ACCESS zhong cha xun SQLSERVER zhong de shu ju
  SELECT * FROM Tab1 IN [ODBC]
  [ODBC;Driver=SQL Server;UID=sa;PWD=;Server=127.0.0.1;DataBase=Demo;]
  wai bu shu ju yuan lian jie shu xing de wan zheng shen shu shi :
  [ODBC;DRIVER=driver;SERVER=server;DATABASE=database;UID=user;PWD=password;]
  qi zhong de DRIVER=driver ke yi zai zhu ce biao zhong de
  HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI zhong zhao dao
  ACCESS zhi chi zi cha xun
  ACCESS zhi chi wai lian jie , dan bu bao kuo wan zheng wai bu lian jie , ru zhi chi
  LEFT JOIN huo RIGHT JOIN
  dan bu zhi chi
  FULL OUTER JOIN huo FULL JOIN
  ACCESS zhong de ri qi cha xun
  zhu yi :ACCESS zhong de ri qi shi jian fen ge fu shi # er bu shi yin hao
  Select * From Tab1 Where [Date]>#2002-1-1#;
  zai DELPHI zhong wo zhe yang yong
  SQL.Add(Format(
  'Select * From Tab1 Where [Date]>#%s#;',
  [DateToStr(Date)]));
  ACCESS zhong de zi fu chuan ke yi yong shuang yin hao fen ge , dan SQLSERVER bu ren , suo yi wei le qian yi fang bian he jian rong ,
  jian yi yong dan yin hao zuo wei zi fu chuan fen ge fu .
  zai SQLSERVER zhong cha xun ACCESS shu ju ku zhong de biao
  SELECT * FROM
  OPENROWSET('Microsoft.Jet.OLEDB.4.0',
  'c:\youfile.mdb';'admin';'youpwd',youtabname)
  AS a
  yi xia SQL yu ju zai ACCESS XP de cha xun zhong ce shi tong guo
  jian biao :
  Create Table Tab1 (
  ID Counter,
  Name string,
  Age integer,
  [Date] DateTime);
  ji qiao :
  zi zeng zi duan yong Counter sheng ming .
  zi duan ming wei guan jian zi de zi duan yong fang kuo hao [] kuo qi lai , shu zi zuo wei zi duan ming ye ke xing .【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
  1.DELPHI zhong cao zuo ACCESS shu ju ku ( jian li .mdb wen jian , ya suo shu ju ku )    yi xia dai ma zai WIN2K,D6,MDAC2.6 xia ce shi tong guo ,    bian yi hao de cheng xu zai WIN98 di er ban wu ACCESS huan jing xia yun xing cheng gong .   // sheng ming lian jie zi fu chuan   Const   SConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;'    +'Jet OLEDB:Database Password=%s;';   //=============================================================================   // Procedure: GetTempPathFileName   // Author : ysai   // Date : 2003-01-27   // Arguments: (None)   // Result : string   //=============================================================================   function GetTempPathFileName():string;   // qu de lin shi wen jian ming   var   SPath,SFile:array [0..254] of char;   begin   GetTempPath(254,SPath);   GetTempFileName(SPath,'~SM',0,SFile);   result:=SFile;   DeleteFile(result);   end;   //=============================================================================   // Procedure: CreateAccessFile   // Author : ysai   // Date : 2003-01-27   // Arguments: FileName:String;PassWord:string=''   // Result : boolean   //=============================================================================   function CreateAccessFile(FileName:String;PassWord:string=''):boolean;   // jian li Access wen jian , ru guo wen jian cun zai ze shi bai   var   STempFileName:string;   vCatalog:OleVariant;   begin   STempFileName:=GetTempPathFileName;   try    vCatalog:=CreateOleObject('ADOX.Catalog');    vCatalog.Create(format(SConnectionString,[STempFileName,PassWord]));    result:=CopyFile(PChar(STempFileName),PChar(FileName),True);    DeleteFile(STempFileName);   except    result:=false;   end;   end;   //=============================================================================   // Procedure: CompactDatabase   // Author : ysai   // Date : 2003-01-27   // Arguments: AFileName,APassWord:string   // Result : boolean   //=============================================================================   function CompactDatabase(AFileName,APassWord:string):boolean;   // ya suo yu xiu fu shu ju ku , fu gai yuan wen jian   var   STempFileName:string;   vJE:OleVariant;   begin   STempFileName:=GetTempPathFileName;   try    vJE:=CreateOleObject('JRO.JetEngine');    vJE.CompactDatabase(format(SConnectionString,[AFileName,APassWord]),    format(SConnectionString,[STempFileName,APassWord]));    result:=CopyFile(PChar(STempFileName),PChar(AFileName),false);    DeleteFile(STempFileName);   except    result:=false;   end;   end;   ACCESS zhong shi yong SQL yu ju ying zhu yi de di fang ji ji dian ji qiao    yi xia SQL yu ju zai ACCESS XP de cha xun zhong ce shi tong guo    jian biao :    Create Table Tab1 (    ID Counter,    Name string,    Age integer,    [Date] DateTime);    ji qiao :    zi zeng zi duan yong Counter sheng ming .    zi duan ming wei guan jian zi de zi duan yong fang kuo hao [] kuo qi lai , shu zi zuo wei zi duan ming ye ke xing .    jian li suo yin :    xia mian de yu ju zai Tab1 de Date lie shang jian li ke chong fu suo yin    Create Index iDate ON Tab1 ([Date]);    wan cheng hou ACCESS zhong zi duan Date suo yin shu xing xian shi wei - you ( you chong fu ).    xia mian de yu ju zai Tab1 de Name lie shang jian li bu ke chong fu suo yin    Create Unique Index iName ON Tab1 (Name);    wan cheng hou ACCESS zhong zi duan Name suo yin shu xing xian shi wei - you ( wu chong fu ).    xia mian de yu ju shan chu gang cai jian li de liang ge suo yin    Drop Index iDate ON Tab1;    Drop Index iName ON Tab1;   ACCESS yu SQLSERVER zhong de UPDATE yu ju dui bi :    SQLSERVER zhong geng xin duo biao de UPDATE yu ju :    UPDATE Tab1    SET a.Name = b.Name    FROM Tab1 a,Tab2 b    WHERE a.ID = b.ID;    tong yang gong neng de SQL yu ju zai ACCESS zhong ying gai shi    UPDATE Tab1 a,Tab2 b    SET a.Name = b.Name    WHERE a.ID = b.ID;    ji :ACCESS zhong de UPDATE yu ju mei you FROM zi ju , suo you yin yong de biao dou lie zai UPDATE guan jian zi hou .    shang li zhong ru guo Tab2 ke yi bu shi yi ge biao , er shi yi ge cha xun , li :    UPDATE Tab1 a,(Select ID,Name From Tab2) b    SET a.Name = b.Name    WHERE a.ID = b.ID;    fang wen duo ge bu tong de ACCESS shu ju ku - zai SQL zhong shi yong In zi ju :    Select a.*,b.* From Tab1 a,Tab2 b In 'db2.mdb' Where a.ID=b.ID;    shang mian de SQL yu ju cha xun chu dang qian shu ju ku zhong Tab1 he db2.mdb( dang qian wen jian jia zhong ) zhong Tab2 yi ID wei guan lian de suo you ji lu .    que dian - wai bu shu ju ku bu neng dai mi ma .    zai ACCESS zhong fang wen qi ta ODBC shu ju yuan    xia li zai ACCESS zhong cha xun SQLSERVER zhong de shu ju    SELECT * FROM Tab1 IN [ODBC]    [ODBC;Driver=SQL Server;UID=sa;PWD=;Server=127.0.0.1;DataBase=Demo;]    wai bu shu ju yuan lian jie shu xing de wan zheng shen shu shi :    [ODBC;DRIVER=driver;SERVER=server;DATABASE=database;UID=user;PWD=password;]    qi zhong de DRIVER=driver ke yi zai zhu ce biao zhong de    HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI   zhong zhao dao   ACCESS zhi chi zi cha xun   ACCESS zhi chi wai lian jie , dan bu bao kuo wan zheng wai bu lian jie , ru zhi chi    LEFT JOIN huo RIGHT JOIN    dan bu zhi chi    FULL OUTER JOIN huo FULL JOIN   ACCESS zhong de ri qi cha xun    zhu yi :ACCESS zhong de ri qi shi jian fen ge fu shi # er bu shi yin hao    Select * From Tab1 Where [Date]>#2002-1-1#;    zai DELPHI zhong wo zhe yang yong    SQL.Add(Format(    'Select * From Tab1 Where [Date]>#%s#;',    [DateToStr(Date)]));   ACCESS zhong de zi fu chuan ke yi yong shuang yin hao fen ge , dan SQLSERVER bu ren , suo yi wei le qian yi fang bian he jian rong ,    jian yi yong dan yin hao zuo wei zi fu chuan fen ge fu .    zai SQLSERVER zhong cha xun ACCESS shu ju ku zhong de biao   SELECT * FROM   OPENROWSET('Microsoft.Jet.OLEDB.4.0',   'c:\youfile.mdb';'admin';'youpwd',youtabname)   AS a    yi xia SQL yu ju zai ACCESS XP de cha xun zhong ce shi tong guo    jian biao :    Create Table Tab1 (    ID Counter,    Name string,    Age integer,    [Date] DateTime);    ji qiao :    zi zeng zi duan yong Counter sheng ming .    zi duan ming wei guan jian zi de zi duan yong fang kuo hao [] kuo qi lai , shu zi zuo wei zi duan ming ye ke xing .
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
上海柏雅居酒店模拍
清晨美丽的风景
梦清园的靓丽女生
妖艳的食人花(7)
且行且攝------"色"影大連
【做股票的朋友看过来-华尔街的铜牛】
端午节后闲逛
捐款赈灾吴川行 花絮
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有