
Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net
>> Thanks for the reply, but my question was exactly what you assume I
>> already know... I'm new to Visual Basic coding, and though I have a
[quoted text clipped - 11 lines]
> How is your ASP.NET app currently configured to interface with the
> database...?
Hi Mark,
The application is a monolithic program written in VB.Net 2003 by a coder
who's no longer here, and I'm coming in on his coat tails to maintain the
code, learning VB along the way. To the best I can determine the
application creates a session with all the general information, like the
UserID, UserName, Groups, and so forth. It then uses datasets, setup both
in the code and via the IDE, to retrieve information from the MS SQL 2005
database.
What I need now is to edit a class so it pulls in a value from an MS SQL
2005 function and stores this value in a variable to use with in the class.
Here's what I've pieced together thus far:
Private Function GetManagerID() As Integer
Dim cn As New
SqlClient.SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("MyConnectionString"))
Dim cm As New SqlClient.SqlCommand("select dbo.ManagerFunction(" +
Me.UserID + ")", cn)
cm.ExecuteNonQuery()
End Function
But how do I get the value from dbo.ManagerFunction(#) into a variable to
use within my application after this function is called? Also note,
MyConnectionString is already defined in the application and stores our
connection information.
Thanks ..
Alex
Mark Rae [MVP] - 12 Sep 2007 16:33 GMT
> The application is a monolithic program written in VB.Net 2003 by a coder
> who's no longer here, and I'm coming in on his coat tails to maintain the
[quoted text clipped - 3 lines]
> in the code and via the IDE, to retrieve information from the MS SQL 2005
> database.
I've been there, and you have my sympathy...
Change your Function as follows:
' cm.ExecuteNonQuery()
cm.Connection.Open()
Dim ReturnValue As Integer = cm.ExecuteScalar()
I should point out that the above may not be 100% correct as I never go
anywhere near VB.NET, but I think that's more or less it...

Signature
Mark Rae
ASP.NET MVP
http://www.markrae.net