从数据库读取数据并写入xml文件,从xml文件读取并写入数据库

编程入门 行业动态 更新时间:2024-10-24 16:31:16
本文介绍了从数据库读取数据并写入xml文件,从xml文件读取并写入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

亲爱的朋友, 我使用以下代码(带有XML)在asp和sql服务器中备份和还原: -------------------------------------------------- --------------------

Dear Friends, I Backup and restore in asp and sql server using following code (with XML): ----------------------------------------------------------------------

public string RestoreData_to_Database(string tableName, DataSet XmlFileDS) { try { DataTable dt = new DataTable(); dt = XmlFileDS.Tables[0]; SqlBulkCopy bulkcopy = new SqlBulkCopy(connect.ConnectionString, SqlBulkCopyOptions.KeepIdentity ); bulkcopy.DestinationTableName = tableName; bulkcopy.WriteToServer(dt); return "true"; } catch(Exception ex) { return ex.Message; } finally { CloseConnection(); } }

-------------------------------------------------- ------ 备份和还原在localhost上可以,但是在具有plesk控制面板的主机上,备份可以,但是在还原过程中会出现以下错误: 用户"a"登录失败.

-------------------------------------------------------- Backup and Restore is OK on localhost, but on a host with plesk control panel,Backup is OK but during restore following error occur : Login failed for user ''a''. in advance, Thanks a lot.

推荐答案

检查与数据库的连接字符串. 在托管环境中,您将必须使用获得的凭据. Check your connection string to your database. In a hosted environment you will have to use the credentials you were given.

更多推荐

从数据库读取数据并写入xml文件,从xml文件读取并写入数据库

本文发布于:2023-07-16 07:25:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119324.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   文件   数据   xml

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!