I am having great problems copying a database SP using the mySQLDump object.
While it works fine when there are no SPs, as soon as I add one, I get the following exception.
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7"
A simple test project which shows the problem is shown below.
Any help would be much appreciated.
Stevod
Imports CoreLab.MySql
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim srcSQLAccessor As New xrSQLAccessor("test")
Dim srcSQLdump As New MySqlDump
Try
srcSQLdump.Connection = srcSQLCommand.Connection
srcSQLdump.Connection.Unicode = True
srcSQLdump.Connection.Database = "test"
srcSQLdump.GenerateHeader = True
srcSQLdump.IncludeDatabase = True
srcSQLdump.ExportAll = True
srcSQLdump.Mode = DumpMode.Schema
srcSQLdump.Tables = ""
srcSQLdump.Backup()
Dim Dbname As String = "test"
Dim dstSQLAccessor As New xrSQLAccessor(Dbname)
Dim dstSQLCommand As CoreLab.MySql.MySqlCommand = srcSQLAccessor.Command
dstSQLCommand.CommandText = "DROP DATABASE IF EXISTS `" & DBName & "`;"
dstSQLCommand.ExecuteNonQuery()
dstSQLCommand.CommandText = "CREATE DATABASE IF NOT EXISTS `" & DBName & "`;"
dstSQLCommand.ExecuteNonQuery()
Dim dstSQLdump As New MySqlDump()
dstSQLdump.Connection = New xrSQLAccessor(DBName).Connection
dstSQLdump.Connection.Database = DBName
dstSQLdump.Connection.Unicode = True
dstSQLdump.DumpText = srcSQLdump.DumpText.Replace("test", Dbname)
dstSQLdump.Restore()
Catch ex As Exception
Stop
End Try
End Sub
End Class
Can't create stored procedure via script
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24