L
liugaohui
Unregistered / Unconfirmed
GUEST, unregistred user!
创建的过程中出现database login对话框,请问怎么样不让该对话框出现?另外如何定义日期型数据为短日期型?好像只能定义为Datetime。源码如下:==============================procedure Tfrmweihu.btncjsjkClick(Sender: TObject);varpath,StrSQL:string;CreateAccess: OleVariant;ADOConn: TADOConnection;constAConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s';begin//创建数据库文件Path := ExtractFilePath(Application.ExeName);if FileExists(Path + 'mydata.mdb') then begin showmessage('数据库文件已经存在!'); exit; end;CreateAccess:=CreateOleObject('ADOX.Catalog');CreateAccess.Create('Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '+Path+'mydata.mdb');//创建数据表ADOConn:=TADOConnection.create(self);ADOConn.ConnectionString:=Format(AConnectionString,[Path +'mydata.mdb','']);Strsql := 'create table mydata (ID autoincrement PRIMARY KEY not null,标签1 char(50) not null,标签2 char(50),标签3 char(50),标签4 char(50),标签5 char(50),标签6 char(50),正文1 text not null,正文2 text,日期 Datetime not null)';ADOConn.Execute(strsql);ADOConn.Close;ADOConn.Free;Showmessage('数据表创建成功,'+#13#10+'请重新启动本程序!');application.terminate;end;