Board index » delphi » SQLDMO Very interesting topic, but cannot use the _Database2
Tin Le
Delphi Developer |
SQLDMO Very interesting topic, but cannot use the _Database22003-11-27 02:15:03 AM delphi15 Hi! everyone! I have problem with the DMO initiate the _Database2. Please check the code. where it has the // Error _databse vs _Database2 Thank you, Tin Le Here is the codes: Function TForm1.sLoadUDFuntions2(SourceServer:Boolean;strDB : String):TStringList; Var strUserID, strPassword, strSQLServer : String; blnSecure : Boolean; intItemCount : Integer; dmo: _SQLServer2; dmoOld: _SQLServer; dmoDatabase : _Database2; SQL_OBJ: oleVariant; Begin Result := TStringList.Create; dmo := CoSQLServer2.Create; dmoOld := CoSQLServer.Create; If SourceServer Then Begin strSQLServer := SSQLServer; blnSecure := SLoginSecure; strUserID := SUserID; strPassword := SPassword; End Else Begin strSQLServer := TSQLServer; blnSecure := TLoginSecure; strUserID := TUserID; strPassword := TPassword; End; dmo.Name := strSQLServer; dmo.LoginSecure := blnSecure; dmo.Login := strUserID; dmo.Password := strPassword; dmo.Connect(dmo.Name, dmo.Login, dmo.Password); // dmoOld does not have UserDefinedFunctions, I can initiate the dmoDatabase here dmoDatabase := dmoOld.Databases.Item(strDB,Null); dmoOld.Name := strSQLServer; dmoOld.LoginSecure := blnSecure; dmoOld.Login := strUserID; dmoOld.Password := strPassword; dmoOld.Connect(dmoOld.Name, dmoOld.Login, dmoOld.Password); // dmo has UserDefinedFunctions, But I cannot initiate the dmoDatabase here dmoDatabase := dmo.Databases.Item(strDB,Null); // Error _databse vs _Database2 { For intItemCount := 1 To dmoDatabase.Tables.Count Do Begin If Not dmoDatabase.Tables.Item(intItemCount, null).SystemObject Then Begin Result.Add(dmoDatabase.Tables.Item(intItemCount,null).Name); End; End; } end; |