Here is the problem. I have a table in a SQL Server database
CREATE TABLE Users
(
[userID] INT PRIMARY KEY IDENTITY,
[userName] NVARCHAR(255) NOT NULL,
[userEmail] VARCHAR(127) NOT NULL,
[userComment] NVARCHAR(2083) NOT NULL,
[userLanguage] VARCHAR(63) NOT NULL,
[regTime] DATE NOT NULL,
[hash] VARCHAR(255) NOT NULL
);
The specific part I have problems with is NVARCHAR
.
I have the following C# code:
UsersDataContext context = new UsersDataContext();
User u = new User() {
userName = name,
userEmail = email,
userComment = story,
userLanguage = lang,
hash = hash,
regTime = System.DateTime.Now
};
context.Users.InsertOnSubmit(u);
context.SubmitChanges();
The problem is that the row inserted into DB looks like this:
???? dbogatov@wpi.edu ???
Russian (cyrillic) symbols are displaying as ???
.
Any ideas how to make DataContext
insert proper NVARCHAR
?
Any help is appreciated.