本文介绍了从数据库读取数据并写入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文件读取并写入数据库
发布评论