Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling SQL SERVER backup & restore fro VFP
Message
De
09/07/2006 12:25:09
 
 
À
07/07/2006 15:35:09
Stephen Hunt
Admit Computer Services Inc.
Farmingdale, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01134436
Message ID:
01134786
Vues:
19
>Ok the backup works ! Thanks ! Now I am trying to do the restore but it tells me that the database is in use, so I tried an SQLDISCONNECT() then SQLEXEC() to run the restore but I know longer have a connection handle to send with the SQLEXEC(). Is there anyway to attach to the database without actually opening it ?
>
>Thanks Again for all your help !
>Stephen J. Hunt

You can attach database, but restore and attach are two different things.
To restore your database you must be sure that thare are no current connections to DataBase. If your connection string includes "
;DataBase=MyDataBase, just remove that string from your connection string. You could connect directly to SQL Server w/o using DataBase name. Here what you must do, before restore your DataBase:
SQLDISCONNECT(CurrentSqlHandler)
RestoreSqlHandler = SQLSTRINGCONNECT([Driver={SQL Server};Server=YourServerName;Uid=USERNAME;Pwd=PASSWORD;])
** Or for trusted connection: RestoreSqlHandler = SQLSTRINGCONNECT([Driver={SQL Server};Server=YourServerName;Trusted_Connection=yes;])

IF SQLEXEC(RestoreSqlHandler,[ restore string here]) < 0
   AERROR(laError)
   MessageBox([Restore is not successful ]+laError[1,2])
ENDIF
SQLDISCONNECT(RestoreSqlHandler)

CurrentSqlHandler = SQLSTRINGCONNECT([Driver={SQL Server};Server=YourServerName;Uid=USERNAME;Pwd=PASSWORD;DataBase=YourDataBase])
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform