asp.net c# 数据库备份
protected void btnsearch_ServerClick(object sender, EventArgs e)
{
string lujing=this.Text2.Value.ToString().Trim();
string shujuku = this.jine.Value;
string wenjianming = this.Text1.Value.ToString().Trim();
if (wenjianming.IndexOf(".bak") == -1)
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('备份文件名格式错误!');</script>");
return;
}
if (System.IO.File.Exists(lujing))
{
//则表示存在
}
else
{
//创建该文件夹
System.IO.Directory.CreateDirectory(lujing);
}
string wenjj = lujing + @"\" + wenjianming;
if (System.IO.File.Exists(wenjj))
{
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('备份文件名已存在,请重新命名!');</script>");
return;
}
string cmd1 = "backu
相关文档:
用c#给PDA做了一个PC端的通讯程序,需要保存两个参数。用Delphi时,是保存在ini文件中,c#读写XML比较方便,就用xml文件来保存了。
class CXmlClass
{
private string XmlFilePath;
/// <summary>
/// 下载到PDA的TXT文件路径
/// </summary>
......
静态变量
当我们编写一个类时,其实就是在描述其对象的属性和行为,而并没有产生实质上的对象,只有通过new关键字才会产生出对象,这时系统才会分配内存空间给对象,其方法才可以供外部调用。
有时候,我们希望无论是否产生了对象或无论 ......
我们可以继承 ASP.NET 的 Page 类别,自行扩充所需的功能!作法如下:
1、继承 System.Web.UI.Page,自订一个 BasePage 类别。
以下为引用的内容:
using
System;
/// <summary>
/// BasePage 的摘要描述
///&nbs ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.Data;
namespace MyDbTest
{
class Program
{
static void Main(string[] args)
{
SqlConnection thisConnection = new SqlConnection(
@ ......
在root账号中,可以正常调用存储过程.
换到common_user账号时,同一存储过程名调用出现问题.
追踪调试时出现:
SELECT command denied to user 'common_user'@'localhost' for table 'proc'
搜索解决方案:
MySqlConnection myconnection = new MySqlConnection("server=localhost;user id=common_user; password=***;dat ......