scalar function call

  • Thread starter Thread starter rodchar
  • Start date Start date
rodchar said:
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.
 

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

Back
Top