Calling sql server user defined function from C#

J

Jesse Houwing

Lalit said:
How can we call a sql server user defined function from C#?

Create a SqlCommand and set the commandtext to

@"select userDefinedFunction(@param, @param)"

Now add these parameters to the SqlCommand aswell and you're all set.

Alternatively you could wrap the UDP in a stored procedure and call that
instead.

Jesse Houwing
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

IIRC you need to include the owner of the function:

@"select dbo.userDefinedFunction(@param, @param)"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top