BACKUP SQL DATABASE IN VB.NET
SQLQuery("backup database " & dATABASENAME & " to disk='" & FILEPATH & "'")
Function SQLQuery(ByVal qSTR As String) As Boolean
Dim retval As Boolean = True
Dim SqlConn1 As New SqlClient.SqlConnection
Try
SqlConn1.ConnectionString = ConnectionStrinG
SqlConn1.Open()
cmd = New SqlCommand(qSTR, SqlConn1)
cmd.ExecuteNonQuery()
SqlConn1.Close()
Catch ex As Exception
retval = False
Try
SqlConn1.Close()
Catch ex2 As Exception
End Try
End Try
Return retval
End Function
No comments:
Post a Comment