尝试执行数据驱动的encodeui测试时ODBC驱动程序管理器出现问题 [英] Problem with ODBC Driver Manager when trying to do data driven codedui test

查看:98
本文介绍了尝试执行数据驱动的encodeui测试时ODBC驱动程序管理器出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在64位Windows 10机器上使用VS 2017

I use VS 2017 on a 64 bit windows 10 machine

DataSource有问题。 ONly AccessDatabaseEngine 2007可以工作,但它会阻止我的编码设置。

Have problem with DataSource. ONly AccessDatabaseEngine 2007 works but it blocks my codeduitests.

无法安装其他32位版本的  AccessDatabaseEngine 因为我的电脑上的办公室是64位。

Cant install other 32 bit versions of AccessDatabaseEngine  since office on my pc is 64 bit.

64个安装的AccessDatabaseEngine   没有帮助,我得到 

64 installations of AccessDatabaseEngine   doesnt help, I get 

rror [IM014] [ Microsoft][ODBC Driver Manager]

更多细节可以在这里找到

more details can be found here

https://stackoverflow.com/questions/ 54435324 / datasource-dilemma-with-64-bit-office

https://stackoverflow.com/questions/54435324/datasource-dilemma-with-64-bit-office

解决方案

你好rastek,

Hi rastek,

欢迎来到MSDN论坛。

Welcome to MSDN forum.

我重现这个问题IM014 ,但由于将Excel设置为Coded UI Test的数据源比csv,xml或sql server更复杂,并且每一个错误都可能导致错误。所以我需要在细节上分享我的步骤。很抱歉给您带来不便。

I reproduce this issue IM014, but since setting Excel as a datasource for Coded UI Test is more complex than csv, xml or sql server, and every single mistake may cause the error. So I need to share my steps in details. Sorry for this inconvenience.

1.我在我的机器上安装Access DataBase引擎2010(X64)(win10 X64)

1.I install an Access DataBase engine 2010(X64) in my machine(win10 X64)

2.打开Microsoft Excel并创建一个空白工作簿并在'Sheet1

2.Open Microsoft Excel and create a blank workbook and write some data in ‘Sheet1


'中写入一些数据,如下所示:
’ like below:




3.File =>另存为=>在D:驱动程序,文件名MyData中创建一个名为MyTest的新文件夹,键入select
Excel 97-2003工作簿(* .xls)(表示MyData.xls)。然后保存它。

3.File=>Save as => create a new folder named MyTest in D: driver, File name MyData, type choose Excel 97-2003 workbook(*.xls) (which means MyData.xls). Then Save it.

4.以管理员身份运行Vs2017,在CUIT中使用上面的语句测试方法:

4.Run Vs2017 as administrator, in CUIT use this statement above test method:

[DataSource(" System.Data) .Odbc"," Dsn = ExcelFiles; Driver = {Microsoft Excel Driver(* .xls)}; dbq = | DataDirectory | \\Data.xls; defaultdir = .; driverid = 790; maxbuffersize = 2048; pagetimeout = 5; readonly = true"," Sheet1

[DataSource("System.Data.Odbc", "Dsn=ExcelFiles;Driver={Microsoft Excel Driver (*.xls)};dbq=|DataDirectory|\\Data.xls;defaultdir=.;driverid=790;maxbuffersize=2048;pagetimeout=5;readonly=true", "Sheet1


",DataAccessMethod.Sequential),
DeploymentItem(" | | DataDirectory | \\ Data.xls"), TestMethod]
", DataAccessMethod.Sequential), DeploymentItem("|DataDirectory|\\Data.xls"), TestMethod]

实际上,我们需要改变的是"Dsn = xxx","dbq = | DataDirectory | \\ Data.xls"和DeploymentItem(" | DataDirectory | \\ \\\Data.xls")。

Actually, what we need to change are "Dsn=xxx", "dbq=|DataDirectory|\\Data.xls" and DeploymentItem("|DataDirectory|\\Data.xls ") .

5.在Vs IDE中,转到Tools =>连接到数据库=>选择"Microsoft ODBC数据源(ODBC)"作为数据源点击"继续"=>选择"使用连接字符串",点击"构建"按钮。

5.In Vs IDE, go Tools=>Connect to Database=>choose "Microsoft ODBC Data Source (ODBC)" as the Data source click "continue"=>choose "Use connection string", Click "Build" button.

6.由于我们有MyData.xls,但我们仍然需要一个DSN来帮助连接到ODBC。所以围绕DSN名称,单击"新建",然后选择"Microsoft Excel Driver(*。xls)"作为我们的驱动程序。 (注意:在下拉列表中,有"Driver Do Microsoft Excel",Microsoft Excel
Driver(*。xls)","Microsoft Excel Driver(* .xls,*。xlsx,...)","Microsoft Excel Treiber"和其他人。)。我们需要的是"Microsoft Excel Driver(*。xls)",它在#4中的数据源字符串中定义。

6.Since we have a MyData.xls, but we still need a DSN to help connect to ODBC. So around DSN name, click "new", and select "Microsoft Excel Driver(*.xls)" as our driver. (Note: In the dropdown list, there has "Driver Do Microsoft Excel", Microsoft Excel Driver(*.xls)", " Microsoft Excel Driver(*.xls,*.xlsx,…)","Microsoft Excel Treiber" and others.) . What we need is "Microsoft Excel Driver(*.xls)" which is defined in my datasource string in #4.

7.之后,单击"下一步",然后"浏览"在"创建新数据源"窗口中,导航到D:\ MyTest \文件夹,保存为类型选择"所有文件",然后我们可以找到MyData.xls,选择并保存。然后next => next => finish =>现在我们在"ODBC Microsoft
Excel Setup"窗口中,单击"选择工作簿",选择"MyData.xls",单击"确定"。

7.After that, click "next", then "browse" in "Create new data source" window, navigate to D:\MyTest\ folder, save as type choose "all files", then we can find MyData.xls, choose it and save. Then next=>next=>finish=> Now we are in "ODBC Microsoft Excel Setup" window , click "select workbook", choose "MyData.xls", click "Ok" .

8.然后选择数据源"窗口如下所示:

8.Then "Select Data Source" window looks like below:




9。单击"确定",然后在"ODBC Microsoft Excel安装程序"中再次单击"确定",现在我们在连接字符串中有一个类似"Driver = {Microsoft Excel Driver(* .xls)}; dbq = ..."的句子。但还不够。

9. Click "Ok", then in "ODBC Microsoft Excel Setup "again click "Ok", now we have a sentence like "Driver={Microsoft Excel Driver (*.xls)};dbq=…" in the connection string. But not enough.

10.点击"build",选择"Machine Data Source",点击"new","user data dource"=> next => Microsoft Excel驱动程序(* .xls)=> next => finish =>数据源名称:MyDataSource =>选择工作簿,选择MyData.xls,"确定",再次单击"确定",我们已成功在机器数据源中添加
一个MyDataSource(数据源名称)。

10.Click "build", choose "Machine Data Source" ,click "new", "user data dource"=> next=>Microsoft Excel Driver(*.xls)=>next=>finish=> Data Source Name: MyDataSource=>select workbook, select MyData.xls, "Ok", again click "OK", we have added a MyDataSource (Data Source Name) in machine data source successfully.




11.双击"MyDataSource",然后连接字符串如下所示:Dsn = MyDataSource; dbq = ....测试连接以确保成功。单击"确定"。

11.Double click "MyDataSource", then the connection string looks like : Dsn=MyDataSource;dbq=… . Test connection to make sure it succeed. Click "OK".

12.从这里开始,有关excel连接的配置正常,在更改"Dsn = MyDataSource","dbq = D:\\ MyTest \之后\ MyData.xls",DeploymentItem("D:\\ MyTest \\MyData.xls")

12.From here, the configuration about excel connection is ok, after that change "Dsn=MyDataSource", "dbq=D:\\MyTest\\MyData.xls", DeploymentItem ("D:\\MyTest\\MyData.xls ")

该声明为:

[DataSource(" System.Data.Odbc"," Dsn = MyDataSource; Driver = {Microsoft Excel Driver(* .xls)}; dbq = D:\\MyTest \\ MyData。 xls; defaultdir = .; driverid = 790; maxbuffersize = 2048; pagetimeout = 5; readonly = true"," Sheet1

[DataSource("System.Data.Odbc", "Dsn=MyDataSource;Driver={Microsoft Excel Driver (*.xls)};dbq=D:\\MyTest\\MyData.xls ;defaultdir=.;driverid=790;maxbuffersize=2048;pagetimeout=5;readonly=true", "Sheet1


这篇关于尝试执行数据驱动的encodeui测试时ODBC驱动程序管理器出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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