I have created a function in SQL, now I need to use that function in my C# application.
I tried using something like this, but it seems I\'m doing it wrong since I\'
At a glance, the first thing I can see is that you aren't specifying the object owner / schema; that is required for functions, so it should be select dbo.Function1(...
Second: look at what your call to string.Format
generates; that is generating @1
and @n
for n
another integer, but that is not a valid parameter name. Which is handy, because
Third: you didn't add any parameters
Fourth: for a table UDF (rather than a scalar UDF), you must select * from dbo.Function1(...
, not just select dbo.Function1(...