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#与Flash交互 (转自小磊在线)
C#与Flash交互
前段日子公司要求做一个C#与Flash交互的东西,用来C#与短信猫通讯将数据传到Flash上显示与操作的应用。
第一步C#添加组件
打开VS2005-工具-选择工具箱项-COM组件-选择Shockwave Flash Object-确定
添加好组件往场景上拖放,如果提示注册需求注册
c# 注册控件-在运行输 ......
用c#给PDA做了一个PC端的通讯程序,需要保存两个参数。用Delphi时,是保存在ini文件中,c#读写XML比较方便,就用xml文件来保存了。
class CXmlClass
{
private string XmlFilePath;
/// <summary>
/// 下载到PDA的TXT文件路径
/// </summary>
......
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(
@ ......
程序启动Sql Server其实很简单
代码:
System.ServiceProcess.ServiceController myController =
new System.ServiceProcess.ServiceController("MSSQL$ACCP4444"); //服务名称 找了半天才找到,笨死我完了。在服务上右键属性,能看到
if (myController.CanStop)
{ }
else ......
已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price> ......