How to access an SQL function via .NET DataAdapter?

  • Thread starter Thread starter Dick Swager
  • Start date Start date
D

Dick Swager

Is there a way to use a DataAdapter to retrieve data via an SQL function? I
have done what I need to do using a stored procedure that returns a 1x1
table, but it seems like it would be much cleaner if the single value
returned by a function could be obtained. Maybe there is some mechanism
other than a DataAdapter. I've been away from this stuff for a while and
I'm trying to re-learn a lot of the C++ / SQL interaction stuff with .NET.

Dick
 
Dick,

Use a command object, for example an SQLCommand object if you are working
with SQL Server.

You can use the command object's ExecuteScalar method to retrieve a single
value.

Kerry Moorman
 
Back
Top