Why does a variable name in a query fail using adapter RRS feed

  • Question

  • Using Visual Studio 2015 VB Table adapter, I fail when I use a program variable.  In the image below, I am trying to execute an update to a table.  The statement is update dbo.xemail    set datarea=dataarea   where xmailid=userem. {See the command line in the pop-up inthe screen below}  The statement is acceptable to the query builder, but when the update is executed {via the "sqlquery statement in the screen below}I get a failure of "undefined Column name" refering to the variable "userem" in the Where portion of the sql.  I have previously failed in the use of a variable name in a query so I believe I am missing something that is available to me and will make this work.  Using the dataset/table adapter method is convenient for everything I have tried that does not include the use of a program variable.  How do I make this work?

    I have tried to explain my issue as well as I can.  I am frustrated at not getting a response after a day plus so I am making a minor edit.  I have posted a similar  question in a different thread and that too was never answered, tho I have found an inefficient workaround to that problem.  This instance of the problem is not as easy to avoid.

    • Edited by elisch123 Thursday, September 3, 2020 3:09 PM
    Wednesday, September 2, 2020 1:18 PM