asp.net(C#) 数据库备份还原 源码
Backup.aspx
protected void Button1_Click(object sender, EventArgs e)
{
string path = Server.MapPath("") + @"\Backup";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
try
{
path = Convert.ToString(Hst.DBUtility.DbHelperSQL.GetSingle("p_DataBaseBack"));
LabelMessage.Text = "备份成功; 文件存放路径在:" + path;
}
catch
{
LabelMessage.Text = "备份失败!请联系管理员";
}
}
DataBack.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Hst.DBUtility;
public partial class SysManager_DataBack : System.Web.UI.Page
{
const string FilePath = "E:\\Backup\\";
int a = 1;
Hst.SysManage.FileControl fc = new Hst.SysManage.FileControl();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
 
相关文档:
IIS 7 默认文件上传大小时30M
要突破这个限制:
1. 修改IIS的applicationhost.config
打开 %windir%\system32\inetsrv\config\applicationhost.config
找到: <requestFiltering>节点,
这个节点默认没有 <requestLimits maxAllowedContentLength="上传 ......
画面:
<asp:HiddenField ID="hfdXuHao" runat="server" />
<asp:TreeView ID="tvMenu" runat="server" CssClass="tvStyle" EnableClientScript="false"
& ......
asp.net遍历HashTable需要用到DictionaryEntry Object,asp.net遍历HashTable,可以通过如下两种方法来实现,
方法一:
foreach (System.Collections.DictionaryEntry objDE in objHasTab)
{
Console.WriteLine(objDE.Key.ToString());
Console.WriteLine(objDE.Value.ToString ......
//实例化一个SmtpClientsmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
SmtpClient smtp = new SmtpClient();
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
//将smtp的出站方式设为 Networksmtp.EnableSsl = false;
//smtp服务器是否启用SSL加密
smtp ......