Click here to Skip to main content
15,996,429 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have refer this mysql backup example
MySqlBackup.NET - MySQL Backup Solution for C#, VB.NET, ASP.NET[^]
when i will take backup of mysql database it will show the following exception

System.argumentOutOffRange exception : Year,Month & day parameters describe an unrepresentable DateTime
at system.Datetime.DatetiTicks(Int32 year,Int32 Month,Int32 day)
at system.Datetime...ctor(int32 year,Int32 Month,Int32 day,int32 hour,int32 minute ,int32 second,int32 milllisecond,datetimekind kind)
at mysql.data.types.mysqlDatetime.GetDatetime();
at mysql.data.mysqlclient.mysqldatareader.getValue(int32 i)
at mysql.data.mysqlclient.mysqldatareader.get_item(int32 i)
at mysql.data.mysqlclient.mysqldatareader.getsqlvaluestring(mysqldatareader rdr)
at mysql.data.mysqlclient.mysqlbackup.ExportStart()
at mysql.data.mysqlclient.mysqlbackup.ExportExecute()

plz suggest any solution on this exception.>
C#
MySqlBackup mb;
    SaveFileDialog sf = new SaveFileDialog();
    sf.FileName = "test " + DateTime.Now.ToString("yyyyMMdd HHmmss") + ".sql";
    if (sf.ShowDialog() != System.Windows.Forms.DialogResult.OK)
    {
        return;
    }

    ProgressBar1.Value = 0;
    timerRead.Start();
    mb.Connection = new MySqlConnection(txtConstr.Text);
    mb.ExportInfo.FileName = sf.FileName;
    mb.ExportInfo.AsynchronousMode = true;
    mb.ExportInfo.CalculateTotalRowsFromDatabase = true;
    mb.ExportInfo.ExportTableStructure = true;
    mb.ExportInfo.ExportRows = true;
    mb.Export();

you can refer the
mysqlbackupnet/MySqlBackup.NET/MySqlBackup.cs
file for export() function
Thanks
Posted
Updated 6-Jun-13 2:26am
v2
Comments
Ron Beyer 6-Jun-13 7:48am    
Please post the code you use to take your back up. There is a lot of code on the page you referenced and its easier if you just post what you use. Use the "Improve question" link above to add it to your question.
vrushali katkade 6-Jun-13 7:54am    
i have used this code from this project
mysqlbackupnet ▶
Simple WinForm Demo (C#)
Sunasara Imdadhusen 6-Jun-13 8:14am    
please provide code snippet for better understanding!!
vrushali katkade 6-Jun-13 8:26am    
plz check the updated question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900