vsts load test datasource issues
- by ashish.s
Hello,
I have a simple test using vsts load test that is using datasource. The connection string for the source is as follows
<connectionStrings>
<add name="MyExcelConn" connectionString="Driver={Microsoft Excel Driver (*.xls)};Dsn=Excel Files;dbq=loginusers.xls;defaultdir=.;driverid=790;maxbuffersize=4096;pagetimeout=20;ReadOnly=False" providerName="System.Data.Odbc" />
</connectionStrings>
the datasource configuration is as follows
and i am getting following error
estError TestError 1,000 The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library.
Error details: ERROR [42000] [Microsoft][ODBC Excel Driver] Cannot update. Database or object is read-only.
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [42000] [Microsoft][ODBC Excel Driver] Cannot update. Database or object is read-only.
I wrote a test, just to check if i could create an odbc connection would work and that works
the test is as follows
[TestMethod]
public void TestExcelFile()
{
string connString = ConfigurationManager.ConnectionStrings["MyExcelConn"].ConnectionString;
using (OdbcConnection con = new OdbcConnection(connString))
{
con.Open();
System.Data.Odbc.OdbcCommand objCmd = new OdbcCommand("SELECT * FROM [loginusers$]");
objCmd.Connection = con;
OdbcDataAdapter adapter = new OdbcDataAdapter(objCmd);
DataSet ds = new DataSet();
adapter.Fill(ds);
Assert.IsTrue(ds.Tables[0].Rows.Count > 1);
}
}
any ideas ?