hi guys, once again i'm stuck
I did try for a while on my own, i know it's sad
anywho moving on, as the name suggests I want to create a function to
return a users name based on their user ID.
here's the page where i tried to write the function:
Usermanager Bll: (only relevant code)Code:Imports Microsoft.VisualBasic Imports System Imports System.ComponentModel Imports Keith.ProjectManager.BO Namespace Keith.ProjectManager.Bll Public Class Common Public Shared Sub CheckLogIn() If Len(HttpContext.Current.Session("UserName")) < 1 Or HttpContext.Current.Session("UserName") = "Guest" Then HttpContext.Current.Session("UserName") = "" HttpContext.Current.Session("UserID") = "" HttpContext.Current.Response.Redirect("default.aspx") Dim LogOutMsg As String LogOutMsg = "Your session has expired" End If End Sub Public Shared Function GetUSerName(ByVal uID As Integer) As String Dim UserList As New UserList UserList = UserManager.GetItem(uID) Dim myUser As New Users Return myUser.Name End Function End Class End Namespace
UserDB DAL:Code:<DataObjectMethod(DataObjectMethodType.Select, False)> _ Public Shared Function GetItem(ByVal id As Integer) As Users Return UserDB.GetItem(id) End Function
the error, this is before i have even tried to use it anywhere:Code:Public Shared Function GetItem(ByVal id As Integer) As Users Dim myUser As Users = Nothing ' Using Dim myConnection As MySqlConnection = New MySqlConnection(myConfig.myConnection) Try Dim myCommand = New MySqlCommand(QueryUserDB.Item(id), myConnection) myConnection.Open() 'Using Dim myReader As MySqlDataReader = myCommand.ExecuteReader Try If myReader.Read Then myUser = FillDataRecord(myReader) End If myReader.Close() Finally CType(myReader, IDisposable).Dispose() End Try myConnection.Close() Finally CType(myConnection, IDisposable).Dispose() End Try Return myUser End Function Private Shared Function FillDataRecord(ByVal myDataRecord As IDataRecord) As Users Dim myUser As Users = New Users myUser.Idkey = myDataRecord.GetInt32(myDataRecord.GetOrdinal("idkey")) myUser.Name = myDataRecord.GetDateTime(myDataRecord.GetOrdinal("name")) myUser.Email = myDataRecord.GetString(myDataRecord.GetOrdinal("email")) myUser.Password = myDataRecord.GetString(myDataRecord.GetOrdinal("psswrd")) Return myUser End Function
ShemCode:Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: BC30311: Value of type 'Keith.ProjectManager.BO.Users' cannot be converted to 'Keith.ProjectManager.BO.UserList'. Source Error: Line 20: Public Shared Function GetUSerName(ByVal uID As Integer) As String Line 21: Dim UserList As New UserList Line 22: UserList = UserManager.GetItem(uID) Line 23: Line 24: Dim myUser As New Users Source File: C:\Inetpub\wwwroot\keithdesign\App_Code\global\BLL\Common.vb Line: 22



LinkBack URL
About LinkBacks


Reply With Quote
look above 


Bookmarks