Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple VFP program to backup SQL Server database
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00857511
Message ID:
00857607
Views:
24
>I need to write a simple VFP program for routine backup of a SQL Server database.
>
>User should only choose database, if more than one, and enter a password. Backup path and name and the rest of the process should be automatic.
>
>Can someone help? Thank you.
>
>Alex

Alex,

You could try this as well:
LOCAL lcSQLScript, loConnection

loConnection = CREATEOBJECT('ADODB.CONNECTION')
loConnection.Open("Provider=SQLOLEDB.1;User ID=MyUserName"+;
	+";PWD=MyPassword"+;
	+";Persist Security Info=False"+;
	+";Initial Catalog=MyDatabaseName"+;
	+";Data Source=MyServerName")

lcSQLScript = ;
"BACKUP DATABASE [MyDatabase] TO  DISK = N'C:\Backups\BackupFilename' "+;
"WITH  INIT ,  NOUNLOAD ,  NAME = N'MyBAckupName',  NOSKIP ,  STATS = 10,  "+;
"DESCRIPTION = N'MyBAckupName',  NOFORMAT "

loConnection.Execute(lcSQLScript)
Cheers,

Zoran
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform