views:

17

answers:

1

I have a UDF in sql server. I want to call this function at frontend (C# Code). Is it possible to do it.

+2  A: 

Yeah, just grab a SqlConnection object and:

var com = yourConnection.CreateCommand();
com.CommandText = "select dbo.MyUdf();";
com.ExecuteScalar();

If it's a table-valued UDF, use ExecuteReader() or something similiar.

Andomar