Forum Discussion

asifmpatel's avatar
asifmpatel
Occasional Contributor
10 years ago

Populating website textbox with value from the DB

Hi there
Ive just signed upto TestComplete and can be classed as a beginner - so apologies in advance if this sounds like a dumb question.

I was wondering if someone could help me with the following.
Im trying to populate a TEXTBox on my website with a value i can retrieve from the Db.
https://snag.gy/GimjzZ.jpg


Ive tried specifying a variable (database query)- but everytime i run the test - i am displayed with an exception.
https://snag.gy/Vo0XOS.jpg

Ive no idea what the issue is.
https://snag.gy/eb7AFY.jpg
https://snag.gy/V9qF3W.jpg


Can someone please help?

Thanks

1 Reply

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Have you put a breakpoint on your fail point in your test and then examined what comes back from your database query?

     

    The reason I ask is that you're variable is a DB Table type... but "Keys" expects a string.  I'm not sure there's a "clean" conversion of one to the other. You might need to do more work to pull the specific value out of the DB Table variable before you pass it to your "Keys" parameter. Try using the "aqConvert.VarToStr" code command in your value field to convert the DB Table value (which, from your query, should contain only a single string) to a string value and see if that works.