Get data from data source to validate againt record in SQL database.

2 posts, 0 answers
  1. Pavan
    Pavan avatar
    1 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2013 Link to this post

    SqlCommand thisCommand = thisConnection.CreateCommand();
    thisCommand.CommandText = "select distinct claimid,claimno,  claimdocumenttypeid from ClaimDocument cd1 inner join Claim c on c.ID = cd1.ClaimID where cd1.RecordStatus = 1 and cd1.claimdocumenttypeid = 1 and c.claimno = Data("Claimno");
    I want to compare the current data from the datasource (data binding) to a SQl query in my coded step. How do i refer to the data in the datasource. For eg: I bound SQL Database Table Claim and it has a column name 'Claimno'. when I write a SQL query  to get me a record from a different table ClaimDocument, I want to make sure that Table Claim's claimno is equal to Table claimdetail's claimno. Following is the code I have written, but i get error on execution. Please help




  2. Cody
    Cody avatar
    3354 posts

    Posted 12 Mar 2013 Link to this post

    Hi Pavan,

    I apologize for the delay getting back to you on this.

    How do i refer to the data in the datasource.

    There are a couple of ways. The most direct method is the Data object e.g.


    This will fetch the current value of the column Claimno from the current row from the datasource bound to the test.

    You can also get at all of the data for the current row using:


    This will return the entire DataTable object containing all the data rows that will be used throughout the life of the test:

    Looking at your code I think the only error is you need to use [ ] instead of ( ) characters.

    All the best,
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top