hi,
I used this solution to restore/backup .
but this error appears while trying a restore (after I created a stored procedure in the database ):string SalesDB = "ee/dw/dd/db/DB.sql";
using (MySqlConnection con = new MySqlConnection(myconn.sales_Coonn))
{
using (MySqlCommand cmd = new MySqlCommand())
{
using (MySqlBackup mb = new MySqlBackup(cmd))
{
cmd.Connection = con;
con.Open();
mb.ImportFromFile(SalesDB);
con.Close();
}
}
}
MySql.Data.MySqlClient.MySqlException: '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 3'
and this error appears while trying backup: p :
MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime
What I have tried:
I can import/export it successfully from Workbench (MySQL server 5.7.21 ).
also when I deleted a stored procedure, I could import it successfully.
all of the stored procedure like this :
CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemsDataByID`(in ID int)
BEGIN
SELECT * FROM st_items where stitems_ID=ID;
END
解决方案Start by looking at the content of the backup file: is it valid looking SQL?
If it isn't, you need to look at your app that produced the file - and we don't have access to that.
If it is, load it into your database management app as a query and cut it down by commenting out from the bottom up. when it runs, add a bit back. when it stops, look at the last bit you added back and see if your can spot the syntax error.
We can't do any of that for you - we don't have access to the backup file, the server, or your code!