Ask a Question

How to fetch the data from a textbox

New Contributor

How to fetch the data from a textbox

I have a keyword test in a windows application and I need fetch data from a textbox



for example the last textbox.


I need safe value on a variable to use in sql query


how i can do that?

thanks for your time an your response


Champion Level 3

Is this your first time using TC? If yes, I suggest you read through Testing Desktop Applications - Tutorial.


Thanks for your help, I've already seen the tutorial and I already have some tests on how to use the data driven loop for example, but in particular I need to save the value that exists in a textbox to be able to use it in a sql query and I don't understand how. Can you help me with an example or video?

thanks for your time.

Champion Level 3

I'm not sure whether you are doing keyword testing or scripting, but once you've captured the value from your text box, store the value into a variable to be used afterwards.


Construct your sql query string, for example var sqlStr = "select * from persons where id = 100", replace the value 100 with your variable. e.g. var sqlStr = "select * from persons where id = " + myvar. Which you can then use afterwards.


There are examples on how to connect to a database, see Using ADO Components.



Regular Contributor

If you need to save a text or value from a textbox you could use:

Set variable value: Aliases.Etc.Etc.Etc.Text or Aliases.Etc.Etc.Etc.Value.

When using the object spy you can see what properties hold what value and just use them when setting the variable in TC. then use that variable in your query command.

Showing results for 
Search instead for 
Did you mean: