G
Guest
Can someone please help... I'm kind of new to asp.net and VS.net and need to
know how to get the value of a variable in the following funtion into a sub
on another aspx page!
Can someone please help!
Thanks
...CODE..
Public Function GetOfficeName() As String
Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("UserDetails", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Myconn.Open()
Dim objParam1 As SqlParameter
objParam1 = cmd.Parameters.Add("@UserName", SqlDbType.Char)
objParam1.Direction = ParameterDirection.Input
objParam1.Value = Page.User.Identity.Name
Dim myReader As SqlDataReader = cmd.ExecuteReader()
While myReader.Read()
If Page.User.Identity.Name <> "" Then
Return myReader("offName")
End If
End While
' always call Close when done reading.
myReader.Close()
' Close the connection when done with it.
Myconn.Close()
End Function
know how to get the value of a variable in the following funtion into a sub
on another aspx page!
Can someone please help!
Thanks
...CODE..
Public Function GetOfficeName() As String
Dim Myconn As New
SqlConnection(ConfigurationSettings.AppSettings("strConn"))
Dim cmd As New SqlCommand("UserDetails", Myconn)
cmd.CommandType = CommandType.StoredProcedure
Myconn.Open()
Dim objParam1 As SqlParameter
objParam1 = cmd.Parameters.Add("@UserName", SqlDbType.Char)
objParam1.Direction = ParameterDirection.Input
objParam1.Value = Page.User.Identity.Name
Dim myReader As SqlDataReader = cmd.ExecuteReader()
While myReader.Read()
If Page.User.Identity.Name <> "" Then
Return myReader("offName")
End If
End While
' always call Close when done reading.
myReader.Close()
' Close the connection when done with it.
Myconn.Close()
End Function