可以参考msdn上安装程序如何自带数据库安装的文章
解决方案 »
- 为什么这个绑定代码,只能绑定一次?
- ORM设计中如何在取得实体对象的时候取得子LIST属性中的对象并把这个对象保存 到对应的表中去?
- vs2005界面设计问题。
- 求救....C#+Oracle
- 启用远程电脑上被禁用的服务
- 帮我看看这个错误提示(DX,C#相关)
- SystemParametersInfo设置桌面墙纸的问题
- sos!水晶报表
- 如何将TXT文本格式的字符串转换为HTML格式?
- 如何得到当前应用域所有线程?
- 类库能否读取配置文件?我用app.config没用,读不到,但也不出错。
- 使用<INPUT type="file">了,选择了一个file后,我要上传了,但是PostFile属性居然返回的是null,我确实选了个file呀。
{
Assembly asm = Assembly.GetExecutingAssembly();
string strPath = asm.Location;
string[] ary = strPath.Split('\\'); //config文件目录
ary[ary.Length-1] = "web.config"; //confing文件名
strPath = string.Join("\\", ary);
XmlDocument xmldoc= new XmlDocument();
xmldoc.Load(strPath); XmlNodeList topM=xmldoc.DocumentElement.ChildNodes;
foreach(XmlElement element in topM)
{
if(element.Name.ToLower()=="appsettings") //找到要改写的字段名
{
XmlNodeList _node=element.ChildNodes;
if ( _node.Count >0 )
{
foreach(XmlElement el in _node)
{
el.Attributes["value"].Value=conn; //查找并改写
}
}
}
}
xmldoc.Save(strPath); //保存改写文件
}
http://www.codeproject.com/csharp/AnyConfig.asp
http://www.codeproject.com/csharp/ReadWriteXmlIni.asp