예제 #1
0
        protected void btExport_Click(object sender, EventArgs e)
        {
            try
            {
                string output = "";

                using (MySqlConnection conn = new MySqlConnection(txtConnString.Text))
                {
                    MySqlCommand cmd = new MySqlCommand();
                    MySqlBackup  mb  = new MySqlBackup(cmd);
                    cmd.Connection = conn;
                    conn.Open();

                    output = mb.ExportToString();
                }

                if (output.Length > (1024 * 100))
                {
                    lbError.Text    = "The length of the output file has exceeded 100KB maximum length limit.<br />Try to use a smaller size of MySQL database sample.";
                    lbError.Visible = true;
                }
                else
                {
                    StoreFile.StoreSqlText(output);
                    Server.Transfer("~/Result.aspx", true);
                }
            }
            catch (Exception ex)
            {
                lbError.Text    = ex.Message;
                lbError.Visible = true;
            }
        }
예제 #2
0
 protected void btDownload_Click(object sender, EventArgs e)
 {
     byte[] ba = StoreFile.GetZipFile();
     Response.Clear();
     Response.AppendHeader("content-disposition", "attachment; filename=MySqlBackup.zip");
     Response.AppendHeader("Content-Length", ba.LongLength.ToString());
     Response.ContentType = "application/zip";
     Response.BinaryWrite(ba);
     Response.End();
 }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PreviousPage == null)
                {
                    Response.Redirect("~/", true);
                    Session.Clear();
                    Session.Abandon();
                    return;
                }

                string dumpcontent = Server.HtmlEncode(StoreFile.GetSqlText());
                PlaceHolder1.Controls.Add(new LiteralControl(dumpcontent));
            }
        }