StrataFrame Forum
Back
Login
Login
Home
»
.NET Forums
»
General .NET Discussion
»
Executing Scalar-Valued Function from VB.NET
Executing Scalar-Valued Function from VB.NET
Post Reply
Like
1
Executing Scalar-Valued Function from VB.NET
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
StarkMike
StarkMike
posted 18 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 436,
Visits: 944
How do I execute a sql server scalar-valued function from vb.net? Is it just like a stored procedure?
Reply
Like
1
Replies
StarkMike
StarkMike
posted 18 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 436,
Visits: 944
Thats awesome! Thanks Greg... that worked. ;-)
Reply
Like
1
StrataFrame Team
S
StrataFrame Team
posted 18 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
Yep, Greg's solution works (just remember to either set the Connection property on the command or call ExecuteScalar(cmd) through a business object)
However, if you ever need to return a value from a stored procedure (or multiple values), you can also use output parameters. After you call ExecuteScalar() or ExecuteNonQuery(), the parameters labeled as Direction = Output will have the values assigned by the server. Just FYI.
Reply
Like
1
StrataFrame Team
S
StrataFrame Team
posted 18 Years Ago
ANSWER
Post Details
Share Post
S
Group: StrataFrame Developers
Posts: 3K,
Visits: 2.5K
Greg's solution also works with more than just scalar values... you can use it with full record sets as well.
Reply
Like
1
Greg McGuffey
Greg McGuffey
posted 18 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 2K,
Visits: 6.6K
Ben Chase (07/20/2007)
Greg's solution also works with more than just scalar values... you can use it with full record sets as well.
I'm not following you Ben. How would you use ExecuteScalar with a "full record sets"? Doesn't it just return a single value?
Reply
Like
1
Greg McGuffey
Greg McGuffey
posted 18 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 2K,
Visits: 6.6K
StarkMike (07/20/2007)
Thats awesome! Thanks Greg... that worked. ;-)
Glad you got it working!
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
Executing Scalar-Valued Function from VB.NET
StarkMike
-
18 Years Ago
[quote]How do I execute a sql server scalar-valued function from...
Greg McGuffey
-
18 Years Ago
Thanks Greg. What I mean is if I create a scalar valued function in...
StarkMike
-
18 Years Ago
Ah...well I hope my previous example helps someone else then.
...
Greg McGuffey
-
18 Years Ago
Thats awesome! Thanks Greg... that worked. ;-)
StarkMike
-
18 Years Ago
Yep, Greg's solution works (just remember to either set the Connection...
StrataFrame Team
-
18 Years Ago
Greg's solution also works with more than just scalar values... you...
StrataFrame Team
-
18 Years Ago
[quote][b]Ben Chase (07/20/2007)[/b][hr]Greg's solution also works...
Greg McGuffey
-
18 Years Ago
[quote][b]StarkMike (07/20/2007)[/b][hr]Thats awesome! Thanks Greg......
Greg McGuffey
-
18 Years Ago
Post Reply
Like
1
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search