• venoym (5/10/2013)

    I think the likely scenario is that the vb code is doing something like this:

    ocmd = ADODB.Command

    ocmd.CommandText = "EXEC dbo.[Procedure] " + sVariable

    ocmd.Execute()

    If you're passing the parameter value into the CommandText in-line, you should try wrapping it in single quotes like this:

    ocmd.CommandText = "EXEC dbo.[Procedure] " + "'" + sVariable + "'"

    This isn't a best practice - it makes your data layer susceptible to SQL Injection attacks. You'd do better passing the value in through a strongly typed parameter. But this should fix the immediate problem.

    Unfortunately, I'm not sure you can fix this without making some change to the VB code - without the single quotes the SP will consume ABC as the parameter value and throw the exception when it gets to the characters after the space (which sounds like exactly what you're seeing).