assign SQL command result to variable



    Hello there

    Im actually making a select command and want to asign the result to a varaible so i can use it later,but i always get en error,"Expexted end of statment in"-on the red line
    Somebody can show the way how to implement it?

    Thanks ahead

    so i wrote the following script:
    Dim VAR
    Set wshshell = WScript.CreateObject("WScript.Shell")

    'Foretells of a connection to the database
    Set cnn=CreateObject("ADODB.Connection")

    'Opens the Database

    cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= D:\UPC\Convert KANA\db2.mdb"
    VAR=cnn.Execute "SELECT HOUSE_NUMBER_EXTENSION_LFI FROM [campaing 3] WHERE [campaing 3].CUSTOMER_NUMBER_CUST='503';"

    'Closes everything


    Saturday, December 22, 2007 6:45 PM


  • What version of VB are you using ?


    This looks like code in VB Script and not VB.NET.


    Perhaps changing the line to


    Code Block

    VAR = cnn.Execute("SELECT HOUSE_NUMBER_EXTENSION_LFI FROM [campaing 3] WHERE [campaing 3].CUSTOMER_NUMBER_CUST='503';")



    ie. putting parenthesis around the execute method parameter.
    Saturday, December 22, 2007 7:06 PM