PC Review


Reply
Thread Tools Rate Thread

Calling sql server user defined function from C#

 
 
Lalit Bhatia
Guest
Posts: n/a
 
      16th Jun 2006
How can we call a sql server user defined function from C#?

--
Regards,
Lalit Bhatia


 
Reply With Quote
 
 
 
 
Jesse Houwing
Guest
Posts: n/a
 
      16th Jun 2006
Lalit Bhatia wrote:
> 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
 
Reply With Quote
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      16th Jun 2006
Hi,

IIRC you need to include the owner of the function:

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



--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"Jesse Houwing" <jesse.houwing@------.nl> wrote in message
news:%(E-Mail Removed)...
> Lalit Bhatia wrote:
>> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel User Defined function calling RTD raoden.ss@gmail.com Microsoft Excel Programming 0 31st Mar 2008 11:34 PM
Excel User Defined function calling RTD Siva Microsoft Excel Programming 1 31st Mar 2008 04:03 PM
Calling user-defined function from adp Sara4 Microsoft Access 1 13th Dec 2007 02:05 PM
Calling user defined function from C/C++ Ravil Microsoft Excel Programming 0 24th Apr 2006 06:05 PM
Calling C# user-defined function in javascript =?Utf-8?B?TXBob3ph?= Microsoft ASP .NET 1 6th Aug 2004 07:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:24 PM.