none
using sqlcommand to filter data RRS feed

  • Question

  •  

    Hi,

     

    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")

    cn.Open()

    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?

     

    cherriesh

    Monday, July 23, 2007 7:16 AM