数据库备份失败.(不打开文件设备.)

来源:百度知道 编辑:UC知道 时间:2024/07/02 07:19:26
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string cmdtxt1 = "Data Source=.;Initial Catalog=ADOtest;Persist Security Info=True;User ID=sa;Password=123;Pooling=False";
string cmdtxt2 = "Exec sp_helpdb";
SqlConnection Con = new SqlConnection(cmdtxt1);
Con.Open();
SqlCommand mycommand = new SqlCommand(cmdtxt2, Con);
SqlDataReader dr = mycommand.ExecuteReader();
DropDownList1.DataSource = dr;
DropDownList1.DataTextField = "name";
DropDownList1.DataBind();
dr.Close();
Con.Close();
}

}
protected void Button1_Click(object sender, EventArgs e)
{
string cmdtxt1 = "Server=.;database='" + DropDownList1.SelectedValue + "';Uid=sa;Pwd=123";<

你用的是vista?文件系统是NTFS?确认目标目录有iis_user或者everyone的写入权限...

看看你的C:\Users\a\Documents\Visual Studio 2008\WebSites\asp.net/目录有没有everyone的读取/写入/新建 权限,记得要给整个目录附权限...

你在catch处
加一个断点,看看错误的具体内容。。。。