There is no error as such!
You just can't use SQLHelper object with OleDB connection So I was wondering
how else it could be done!
Here is what I'm working on!
Sub Application_Aut henticateReques t(ByVal sender As Object, ByVal e As
EventArgs)
' Fires upon attempting to authenticate the use
If Request.IsAuthe nticated Then
Dim objConn
Dim cmd As OleDbCommand
Dim strSQL As String
strSQL = "SELECT group FROM persons = @Username"
objConn = New
OleDbConnection (ConfigurationS ettings.AppSett ings("strConn") )
cmd = New OleDbCommand(st rSQL, objConn)
'Determine this user's roles
Dim reader As OleDbDataReader
cmd.Parameters. Add("@Username" , User.Identity.N ame)
reader = cmd.ExecuteRead er
' Create an array of role names
Dim roleList As New ArrayList
Do While reader.Read()
roleList.Add(re ader("Name"))
Loop
reader.Close()
'Convert the roleList ArrayList to a String array
Dim roleListArray As String() = roleList.ToArra y(GetType(Strin g))
'Add the roles to the User Principal
HttpContext.Cur rent.User = _
New
System.Security .Principal.Gene ricPrincipal(Us er.Identity, roleListArray)
End If
End Sub
"Patrick.O. Ige" wrote:
Where are you getting the error?
Patrick
"Tim::.." <myatix_at_hotm ail.com> wrote in message
news:6B******** *************** ***********@mic rosoft.com... Can someone please tell me how I edit this code so it works with an
OleDB...
Thanks
Sub Application_Aut henticateReques t(ByVal sender As Object, ByVal e As
EventArgs)
' Fires upon attempting to authenticate the use
If Request.IsAuthe nticated Then
'Determine this user's roles
Dim reader As OleDbDataReader
reader =
SqlHelper.Execu teReader(Config urationSettings .AppSettings("s trConn"),
CommandType.Sto redProcedure, "rolesForUs er", New
OleDbParameter( "@Username" ,
User.Identity.N ame))
' Create an array of role names
Dim roleList As New ArrayList
Do While reader.Read()
roleList.Add(re ader("Name"))
Loop
reader.Close()
'Convert the roleList ArrayList to a String array
Dim roleListArray As String() =
roleList.ToArra y(GetType(Strin g))
'Add the roles to the User Principal
HttpContext.Cur rent.User = _
New
System.Security .Principal.Gene ricPrincipal(Us er.Identity, roleListArray)
End If
End Sub