Link to home
Start Free TrialLog in
Avatar of Erwin Pombett
Erwin PombettFlag for Switzerland

asked on

i have a command (query) against microsoft sql server, i ask only one value, i have it , how can i recover it ?

Hello ,


i have a code that query a mssql db as follows :

    $query = "SELECT email From Person Where EmployeeID='ESC" + $person.Split(';')[0] +"'"

    $command = $connection.CreateCommand()
    $command.CommandText = $query


    $result = $command.ExecuteReader()

question :
how to recover the email value ??? how should i use $command in order to have one value not a table ?

thank you in advance.
ASKER CERTIFIED SOLUTION
Avatar of dsacker
dsacker
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Erwin Pombett

ASKER

thank you dsacker,

am i forced to create a datatable ?
is it not possible as it 's only one value, get it straight into a simple variable ?

thank you for further help.

toshi
Actually, the variable $Email contains the value you're looking for.