Salve
volevo sapere come effettuare il backup in vb6 di un database sql i
codice:
Dim str As String
str = "BACKUP DATABASE prova"
str = str & " TO DISK = 'C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\prova1.bak'"
str = str & " WITH FORMAT,"
str = str & " MEDIANAME = 'C_SQLServerBackups',"
str = str & " NAME = 'brckup completo di prova';"
rs.Open str, cn 'errore variabile del blocco whith non impostato
cn ed rs sono variabili globali inizializate in una funzione
codice:
Function connessione() As Boolean
On Error GoTo gerr
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim str As String
str = "C:\Programmi\Microsoft SQL Server\MSSQL.1\MSSQL\Data"
cn.ConnectionString = "Provider=SQLNCLI.1;Integrated Security=SSPI;" & _
"Persist Security Info=False;" & _
"AttachDBFileName=" & str & "\prova.mdf;Data Source=LAPTOP_SIMONE\SQLEXPRESS"
cn.Open
connessione = True
Exit Function
gerr:
connessione = False
End Function
come devo fare?