views:

39

answers:

1

Hi, in my web site (c# & sql server) i am trying to enable non ascii username and passwords, (username and password columns are set to NvarChar )

what would be the best aproach to achive this?

+1  A: 

I guess you must not have tried this yet.

.NET strings are Unicode. There should be nothing special you have to do.


Try

select * from site_users where un=N'محبوب' and pw=N'محبوب'
John Saunders
i have with post and get. I have manually entered محبوب as username and pw to my table and tried with post and get in get محبوب gets url encoded and i would expect it may not work but in post method result was same. then i tried query with sql management studio select * from site_users where un='محبوب' and pw='محبوب'it didn't return any result too
nLL
You need N'text'. See my edit.
John Saunders
thank you N' solved the problem
nLL
sorry would you mind checking this. i got below code to pass paramater to sp, although direct select with N work when i pass string to sqp it doesnt..snip.. cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@un", SqlDbType.NVarChar).Value = un; cmd.Parameters.Add("@pw", SqlDbType.NVarChar).Value = pw;..snip..
nLL
please igonere my last reply. it was my mistake. forgot to set @un to nvarchar
nLL
No problem. You found it yourself quickly enough!
John Saunders