Web Test->DataSource Attribute ->Connection String from App.Config ?

 

Hi,

i have a connection string defined in my app.config and i want to use in the DataSource Attribute In my Web Test . i am getting an error that the connection string must be a constant.
i saw and followed a similar thread regarding this issue but nothing.

code sample:

<DataSource("DataSource1", "Provider=OraOLEDB.Oracle.1;Data Source=GENERIC;PersistSecurityInfo=True;UserID=*****;Password=****", Microsoft.VisualStudio.QualityTools.WebTestFramework.DataBindingAccessMethod.Sequential, "SUBS_INFO"), _

DataBinding("DataSource1", "MyTable", "MyCol", "DataSource1.MyTable.MyCol")> _

To
<DataSource("DataSource1",My.Setting.connectionString,....

thanks Udi



Answer this question

Web Test->DataSource Attribute ->Connection String from App.Config ?

  • RolfBjarne

    Try creating a web test and using the UI to add the data source. Then generate code and use the generated code in your test.

    I can't tell for sure due to wrapping, but it looks like you have an extra line feed after the "<DataSource..." line.


  • SKK&amp;#42;

    Would anyone be kind enough to post an example (C#) of how this would work using a webtest in RC1. In another post (http://forums.microsoft.com/msdn/ShowPost.aspx PostID=12956) it seems to suggest using a DataSourceAttribute ctor that isn't available to me.

    Thanks

    Mountain

  • Web Test->DataSource Attribute ->Connection String from App.Config ?