Here is my code it gives me error "IsAdminuser is not member of PMS"
what should i do now to resolve this problem.

Module GlobalStuff  

Public Function IsLoggedIn(ByVal PassUserName As String, ByVal PassPassword As String) As Boolean  
Dim ReturnBool As Boolean = True        
Dim cnString As String = "Data Source=ITS;Initial Catalog=Payment;Integrated Security=True"         
Dim conn As SqlConnection = New SqlConnection(cnString)     
Dim sql = "SELECT Username,Pass,IsAdmin FROM Login WHERE Username = '" & PassUserName & "' AND Pass = '" & PassPassword & "'" 
Dim cmd As SqlCommand = New SqlCommand(sql, conn)  
Try  
conn.Open()  
Dim dr As SqlDataReader = cmd.ExecuteReader  
'ReturnBool = dr.Read()  
' since the select statement is going to return a value that   
' we want to read we will go ahead and read it in 
If dr.Read() Then  
GlobalStuff.IsAdminUser = Convert.ToBoolean(dr("IsAdmin").ToString())  
Else  
GlobalStuff.IsAdminUser = False  
ReturnBool = False  
End If     
Catch Exp As SqlException  
ReturnBool = False  
'Put other code to handle, log, etc... errors here  
Catch Exp As Exception  
ReturnBool = False  
'Put other code to handle, log, etc... errors here  
Finally  
If conn IsNot Nothing AndAlso conn.State <> ConnectionState.Closed Then  
conn.Close()  
End If            
End Try  
Return ReturnBool  
End Function  
End Module

Recommended Answers

All 3 Replies

i assume you have defined IsAdminUser as a global variable in this module.
so change GlobalStuff.IsAdminUser to IsAdminUser

Now it gives error Name IsAdminUser is not declared.

then please tell us where and how you have defined this variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.