Skip to content
Advertisement

N”’ prefix is added by default while executing Stored Procedure

While executing stored procedure, I’m passing 4 arguments. After passing the arguments through GUI mode, I’m seeing that some prefixes has been added by the sql itself.

So when I am removing the N”, it’s giving me an error saying Invalid column name ‘BSCCS’. What does it mean ?

Full Stored Procedure –

The problem with this is I am passing the parameters from C# code so only ‘BSCCS’ is passed into the stored procedure resulting in the above mentioned error.

C# Code –

Advertisement

Answer

you should change your dynamic query like this, otherwise – because of dynamic query – SQL executes your parameters like columns.

I changed

A.CourseCode=' + @coursecode + ' and A.SubjectCode =' + @subjectcode + '

to this

A.CourseCode=''' + @coursecode + ''' and A.SubjectCode =''' + @subjectcode + '''

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement