Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
SQDLDOM e copia db
lunedì 23 ottobre 2006 - 10.57
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
memmo77
Profilo
| Expert
683
messaggi | Data Invio:
lun 23 ott 2006 - 10:57
Ho un problema, sotto riporto il codice che uso per fare la copia di un db, fino al detach tutto ok quando vado a copiare il file, mi dice che non lo trova, ma il file è nel percorso indicato. Da cosa può dipendere? Grazie
Dim sql As Object
Dim db As Object
Dim tb As SQLDMO.Table
Dim strMDFfilePath As String
Dim strMDFfileName As String
Dim strLOGfile As String
Try
'Create Objects
sql = CreateObject("SQLDMO.SQLServer")
db = CreateObject("SQLDMO.Database")
'Connect to the server
'sql.Connect(strSrv, strLogin, strPwd)
sql.Connect(strSrv, txtUserName.Text, txtPass.Text)
'Set the database object
db = sql.Databases(strDatabase, "dbo")
'Determine the location of database files, primary and log
strMDFfilePath = db.PrimaryFilePath
strMDFfileName = Trim(db.FileGroups.Item(1).DBFiles.Item(1).PhysicalName)
strLOGfile = Trim(db.TransactionLog.LogFiles(1).PhysicalName)
'Clear out the database object
db = Nothing
'Detach database to allow copying
sql.DetachDB(strDatabase)
'Copy database files to new names
FileCopy(strMDFfileName, strMDFfilePath & strNewName & ".mdf")
FileCopy(strLOGfile, strMDFfilePath & strNewName & "_log.ldf")
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !