A
AntoonC
Guest
I have the following code:
Dim BackupQuery As String
BackupQuery = "Backup database Requirements.mdf To Disk=g:\test.bak"
Using conn As New SqlConnection(My.Settings.RequirementsConnectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = BackupQuery
End With
Try
conn.Open()
comm.ExecuteNonQuery()
MsgBox("Backup Completed!", MsgBoxStyle.OkOnly, "Successful")
conn.Close()
Catch ex As SqlException
MessageBox.Show(ex.Message.ToString(), "Error Message")
Finally
conn.Dispose()
End Try
End Using
End Using
What ever a try I always get the same error: Incorrect syntax near '.' What am I doing wrong??
Continue reading...
Dim BackupQuery As String
BackupQuery = "Backup database Requirements.mdf To Disk=g:\test.bak"
Using conn As New SqlConnection(My.Settings.RequirementsConnectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = BackupQuery
End With
Try
conn.Open()
comm.ExecuteNonQuery()
MsgBox("Backup Completed!", MsgBoxStyle.OkOnly, "Successful")
conn.Close()
Catch ex As SqlException
MessageBox.Show(ex.Message.ToString(), "Error Message")
Finally
conn.Dispose()
End Try
End Using
End Using
What ever a try I always get the same error: Incorrect syntax near '.' What am I doing wrong??
Continue reading...