Hi Sonia,
You can use the following code to return the UserID of the first record matching your where condition:
int UserId = ValidationHelper.GetInteger(UserInfoProvider.GetUsers()
.WhereLike("asia_nationalcode", "%" + NationalCode + "%")
.Column("UserID")
.TopN(1)
.GetScalarResult<int>()
, 0);
The query is wrapped in ValidationHelper.GetInteger()
in case no result is returned from the query.
Hope this helps.