Page 1 of 1

TMSDump Example

Posted: Thu 13 Oct 2016 14:31
by Jerbear
Hi Guys.
I can use this to backup a chosen database but can do nothing else until backup is complete
and there is no indication on screen that a backup is taking place.

Code: Select all

  
  BakUpFile := 'C:\MYBACKUPS\MYDATA.BAK';
  MyQuery.SQL.Clear;
  BakUpQuery := 'BACKUP DATABASE ['+DBName+'] TO  DISK = N'''+BakUpFile+'''';
  MyQuery.SQL.Add(BakUpQuery);
  MyQuery.Execute;
  
I'm told that TMSDump might be what I'm looking for but have no idea how to translate
the above code to work with TMSDump. Anyone help me out here please....

Re: TMSDump Example

Posted: Fri 14 Oct 2016 00:15
by LHSoft
try:
TMSConnection.OnInfoMessage

best regards
hans

Re: TMSDump Example

Posted: Fri 14 Oct 2016 09:59
by Jerbear
Sorry LHSoft,
but I have no clue what to do with that.
looked it up in the docs as well and it didn't help.
Did I mention I was a NEWBIE at this......????

Re: TMSDump Example

Posted: Fri 14 Oct 2016 10:14
by LHSoft
Just Try it:

Code: Select all

procedure TMSConnectionInfoMessage(Sender: TObject; E: EDAError);
begin
   ShowMessage(E.Message);
end;
and then let your application react on e.message

Re: TMSDump Example

Posted: Mon 17 Oct 2016 07:33
by Jerbear
Morning Hans,
Sorry but I think you must have missed the part where I said I was a NEWBIE.

It's not much help I'm afraid without some serious explanation and my original question was related to the TMSDump Function/Procedure...

regards
Jer.

Re: TMSDump Example

Posted: Mon 17 Oct 2016 12:31
by azyk
In order to display the backup execution progress in the user application, in T-SQL command BACKUP DATABASE, set a value, such as 10, for option STATS. Now, during the execution of each 10% of backup, SDAC will receive info messages from SQL Server, which can be processed in the TMSConnection.OnInfoMessage event handler. To do this, in the code you provided, replace the line

Code: Select all

BakUpQuery := 'BACKUP DATABASE ['+DBName+'] TO  DISK = N'''+BakUpFile+'''';
with

Code: Select all

BakUpQuery := 'BACKUP DATABASE ['+DBName+'] TO  DISK = N'''+BakUpFile+'''' + ' WITH STATS = 10;';
For more information on BACKUP DATABASE, please refer to MSDN: https://msdn.microsoft.com/en-us/library/ms186865.aspx
The TMSDump component is used to create a T-SQL script of a backup - it does not allow to create a backup in bak format of SQL Server. For more information on TMSDump, please refer to our online documentation: https://www.devart.com/sdac/docs/?devar ... msdump.htm

Re: TMSDump Example

Posted: Mon 17 Oct 2016 14:30
by Jerbear
Many thanks.
That's easier to understand.
Will give this a try later today...

Regards
Jerry