473,387 Members | 1,534 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

scalar function call

hey all,
is it possible to call a sql server scalar function from c#?

thanks,
rodchar
Mar 21 '08 #1
3 7588
rodchar wrote:
hey all,
is it possible to call a sql server scalar function from c#?
Yes, but not directly. You'll have to use a statement of the form "SELECT
dbo.FunctionName(@Param1, @Param2, ...)" and you can use .ExecuteScalar() on
the command object. Be careful with the results: if it's NULL, you'll get
DBNull.Value, otherwise an object of the most appropriate type.

--
J.
Mar 21 '08 #2
On Fri, 21 Mar 2008 12:16:01 -0700, rodchar
<ro*****@discussions.microsoft.comwrote:
hey all,
is it possible to call a sql server scalar function from c#?
Seems like DbCommand.ExecuteScalar() would do what you want. Right?
Mar 21 '08 #3
thanks all for the help,
rod.

"rodchar" wrote:
hey all,
is it possible to call a sql server scalar function from c#?

thanks,
rodchar
Mar 21 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Michael | last post by:
Hello everybody, Newbie here. I've been working on this for the last two days and I can't figure out where this problem is. I think it's something so obvious, but I can't see it! OK, firstly...
4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
16
by: Martin Jørgensen | last post by:
Hi, Short question: Any particular reason for why I'm getting a warning here: (cast from function call of type int to non-matching type double) xdouble = (double)rand()/(double)RAND_MAX;
5
by: marcsirois | last post by:
I have an SQL Query that looks like this. I simplified it for the purpose of this example, but it's still a runnable query SELECT TOP 1 FundedPositions.PositionNumber AS , (select top 1...
0
by: ZXDALMA | last post by:
Dear colleagues, I'm programming in ADS-OnLine Language attached to a DB2 V7R1 server which acts as a data repository. I need to know how to use the scalar function IDENTITY_VAL_LOCAL in order...
0
by: mav | last post by:
I've created an external scalar function (Java) on our iSeries v5r3 that connects to an MS SQL server to call a stored procedure. This function is incredibly slow because it needs to connect to the...
1
by: myschelle848691 | last post by:
Hi Guys, So i've just been told that SELECT INTO cannot be used within a scalar function. Can anyone please tell me why? Secondly, can I use a cursor on a view? and all within a function? ...
1
by: George2 | last post by:
Hello everyone, Such code segment is used to check whether function call or exception- handling mechanism runs out of memory first (written by Bjarne), void perverted() { try{
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.