我
我是电气学子
Unregistered / Unconfirmed
GUEST, unregistred user!
unit dongtaichuangjianshujuku;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Registry, DB, ADODB;
type
TForm1 = class(TForm)
TInitDbDataMoudule = class(TDataModule)
dbInitDb: TDatabase;
private
{ Private declarations }
function GetSQLServerPath:String;
public
{ Public declarations }
procedure CreateDb(dbName : String;dbSize : String);
end;
var
Form1: TForm1;
InitDbDataMoudule: TInitDbDataMoudule;
implementation
{$R *.dfm}
function TInitDbDataMoudule.GetSQLServerPath:String;
var
reg : TRegistry;
path : String;
begin
path := '';
reg :=TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('Software/Microsoft/MSSQLServer/Setup', False);
path := reg.ReadString('SqlPath');
reg.CloseKey;
reg.free;
Result := path;
end;
procedure TInitDbDataMoudule.CreateDb(dbName : String;
dbSize : String);
var
sqlPath : String;
dataFile : String;
logFile : String;
createDbSql : String;
begin
sqlPath := GetSQLServerPath;
dataFile := sqlPath + '/data/' + dbName + '_data.mdf';
logFile := sqlPath + '/data/' + dbName + '_log.ldf';
createDbSql := 'Create Database ' + dbName +
' on primary(Name = ' + dbName + '_dat' +
', FileName = "' + dataFile +
'" , Size = ' + dbSize +
', FileGrowth = 1) ' +
'log on (Name = ' + dbName + '_log' +
', FileName = "' + logFile +
'", Size = ' + dbSize +
', FileGrowth = 1)';
if Not (FileExists(dataFile) or FileExists(logFile)) then
[gold]dbInitDb.[/gold]
end;
end.
当我输入dbinitdb.(倒数第三排)的时候,出现Unable to invoke Code Completion due to error in source code这样的错误,但是和前面的定义部分是一样的啊,请问这是什么错误啊?我搞了一天还是搞不明白.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Registry, DB, ADODB;
type
TForm1 = class(TForm)
TInitDbDataMoudule = class(TDataModule)
dbInitDb: TDatabase;
private
{ Private declarations }
function GetSQLServerPath:String;
public
{ Public declarations }
procedure CreateDb(dbName : String;dbSize : String);
end;
var
Form1: TForm1;
InitDbDataMoudule: TInitDbDataMoudule;
implementation
{$R *.dfm}
function TInitDbDataMoudule.GetSQLServerPath:String;
var
reg : TRegistry;
path : String;
begin
path := '';
reg :=TRegistry.Create;
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.OpenKey('Software/Microsoft/MSSQLServer/Setup', False);
path := reg.ReadString('SqlPath');
reg.CloseKey;
reg.free;
Result := path;
end;
procedure TInitDbDataMoudule.CreateDb(dbName : String;
dbSize : String);
var
sqlPath : String;
dataFile : String;
logFile : String;
createDbSql : String;
begin
sqlPath := GetSQLServerPath;
dataFile := sqlPath + '/data/' + dbName + '_data.mdf';
logFile := sqlPath + '/data/' + dbName + '_log.ldf';
createDbSql := 'Create Database ' + dbName +
' on primary(Name = ' + dbName + '_dat' +
', FileName = "' + dataFile +
'" , Size = ' + dbSize +
', FileGrowth = 1) ' +
'log on (Name = ' + dbName + '_log' +
', FileName = "' + logFile +
'", Size = ' + dbSize +
', FileGrowth = 1)';
if Not (FileExists(dataFile) or FileExists(logFile)) then
[gold]dbInitDb.[/gold]
end;
end.
当我输入dbinitdb.(倒数第三排)的时候,出现Unable to invoke Code Completion due to error in source code这样的错误,但是和前面的定义部分是一样的啊,请问这是什么错误啊?我搞了一天还是搞不明白.