Statistiche |
- Views Home Page: 42.978
- Views Posts: 73.498
- Views Gallerie: 823
- n° Posts: 24
- n° Commenti: 11
|
Archivio Posts |
Anno 2007
Anno 2006
|
|
BackUp e Restore con MSDE
Vi illustro di seguito un esempio di codice per poter effettuare il Backup ed il successivo Restore di un Database MSDE....
Imports System.Data.SqlClient
Dim SqlConn As New SqlConnection() Dim SqlCmd As New SqlCommand()
SqlConn.ConnectionString="Data Source=(local);Initial Catalog=master;Integrated Secutity=SSPI" SqlConn.Open()
Rem -----Backup SqlCmd.Connection=SqlConn SqlCmd.CommandType=CommandType.Text SqlCmd.CommandText="BACKUP DATABASE [nomedb] TO DISK = N'D:\nomedb.bak' WITH INIT,NAME = N'nomedb Backup'"
Try SqlCmd.ExecuteNonQuery() Catch Msgbox(err.description) ENd Try SqlCmd.Dispose()
Rem -----restore SqlCmd.Connection=SqlConn
SqlCmd.CommandType=CommandType.Text SqlCmd.CommandText = "RESTORE DATABASE [nomedb] FROM DISK = N'D:\nomedb.bak' WITH FILE =1,RECOVERY,MOVE N'nomedb TO N'C:\Programmi\Microsoft Sql Server\MSSQL\data\nomedb.mdf', MOVE N'nomedb_log' TO N'C:\Programmi\Microsoft Sql Server\MSSQL\data\nomedb_log.ldf'"
Try
SqlCmd.ExecuteNonQuery()
Catch
Msgbox(err.description)
ENd Try
SqlCmd.Dispose()
SqlConn.Dispose() SqlConn.Close()
martedì, 04 apr 2006 Ore. 10.54
|
Calendario |
| l | m | m | g | v | s | d |
---|
25 | 26 | 27 | 28 | 29 | 30 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 1 | 2 | 3 | 4 | 5 |
|
|