• We need a lot more information to stand much chance of helping.

    When you say it doesn't work, exactly what do you mean? Are you getting an error message?

    Just looking at the SQL you are generating, I can see a problem... the first select should have a comma between the two columns you are selecting:-

    Select ' ---Select Customer --- ', 'CompanyName'

    There are other potential problems e.g. I suspect CustomerId will be an integer. If it is you will probably get another error when SQL Server tries to convert ' ---Select Customer --- ' to an integer.