using sqlcommand to filter data RRS feed

  • Question




    I have this code inside my script component in SSIS to access my table:


    Dim varUser As Guid = Row.OwningUser

    Dim cn As SqlConnection

    Dim SQLCmd As SqlCommand

    cn = New SqlConnection("Server=localhost;database=SONY_CS_PLATFORM")


    SQLCmd = New SqlCommand("select userkey from dim_t_user where userid = " & varUser, cn)


    USERID in dim_t_user has a uniqueidentifier data type. however, i keep receiving this comment for my sql statement inside the sqlcommand which is :


    Operator '&'  is not defined for types 'String' and System.Guid.


    How can i specify the parameter with GUID datatype in sqlcommand?



    Monday, July 23, 2007 7:16 AM