vsts load test datasource issues

Posted by ashish.s on Stack Overflow See other posts from Stack Overflow or by ashish.s
Published on 2010-03-23T19:50:23Z Indexed on 2010/03/23 19:53 UTC
Read the original article Hit count: 433

Filed under:
|

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 ?

© Stack Overflow or respective owner

Related posts about visual-studio-2008

Related posts about c#