Developer forum

Forum » Feature requests » User.GetUserBySQL SQLParameters

User.GetUserBySQL SQLParameters

Dennis van de Giessen
Reply

Hello, 

I'm trying to retreive an used based on email adres (UserManagement)

There is a function Called User.GetUserBySql but it only accepts SQL as an argument.

I was hoping  an overload could be added which allows the usage of SqlParameters
 

Current:

Dim user As User = user.GetUserBySql(String.Format("select * from AccessUser Where AccessUserEmail = '{0}'", currentCustomerEmail))

 

Desired:

' Define list of parameters
Dim parameters As New List(Of SqlParameter)

' SQL String
Dim sql As String = "select * from AccessUser Where AccessUserEmail = @email"

' Add Parameters with values to list of parameters
sqlParameters.Add(New SqlParameter("@email", currentCustomerEmail))

' Retrieve user
Dim user As User = user.GetUserBySql(sql, parameters)

Replies