Variables in quotes RRS feed

  • Question

  • Hello,

    I am trying to use database connectivity in vb6 but am stuck at a step.

    Now suppose, I consider this code:

    rs.Open "select * from Table where Fld = 'Samp'"

    This appears to work pretty well.

    However, when I want the value of 'Fld' to be extracted from a text box.

    It should be something like:

    rs.Open "select * from Table where Fld = txtAbcd.text"

    What is the right placement of single quotes ('   ') in the above code as it does not work. ( I know the reason why as txtAbcd.text is in double quotes and wont yield the value in the text box). So I will need to use single quotes as well as either the & or the + operator. What is the correct way of writing the above code?

    Please help



    Sunday, May 26, 2013 1:06 PM

All replies