数据目录问题 [英] DataDirectory Issue

查看:89
本文介绍了数据目录问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用下面的代码从XML文件中获取数据.

DeploymentItem

( ),

解决方案

检查以下链接:

http://csharp.net-informations.com/xml/how-to -read-xml.htm

http://www.codeproject.com/Questions/196589/Using -C-读取XML文件

http://www.codeproject .com/Articles/34672/Use-of-XML-File-for-Dynamically-Storing-Data-and-R


I am using below code to fetch data from the XML file.

DeploymentItem

("AutomationTestSuite\\Data\\UnloadMed.xml"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\UnloadMed.xml", "StationMed", DataAccessMethod.Sequential)

Above code is working fine to fetch data from single file. But, I need to fetch same file from different location at runtime. But, I am not able to do it as we cannot pass any variable containing the dynamic paths in the DataSource context. 

Let Say, we have 3 folders, FolderA, FolderB & FolderC. All of them contains same file i.e. Unload.xml. Now, I want to modify the DataDirectory path to fetch the same file from different folders at runtime as per the requirement.

So, is there any way out to achieve this. Please help me out.

Thanks In Advance. 


解决方案

check the links below:

http://www.c-sharpcorner.com/UploadFile/75a48f/how-to-use-xml-file-to-store-data-and-retrieve-data-using-as/

http://csharp.net-informations.com/xml/how-to-read-xml.htm

http://www.codeproject.com/Questions/196589/Using-C-to-read-XML-file

http://www.codeproject.com/Articles/34672/Use-of-XML-File-for-Dynamically-Storing-Data-and-R


这篇关于数据目录问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆