Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Computer calculate expression Pin
Pavlex411-Dec-16 6:22
Pavlex411-Dec-16 6:22 
GeneralRe: C# Computer calculate expression Pin
Patrice T11-Dec-16 8:29
mvePatrice T11-Dec-16 8:29 
QuestionC# SQL Server problem Pin
Pavlex410-Dec-16 5:32
Pavlex410-Dec-16 5:32 
AnswerRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 5:39
mveOriginalGriff10-Dec-16 5:39 
GeneralRe: C# SQL Server problem Pin
Pavlex410-Dec-16 5:55
Pavlex410-Dec-16 5:55 
GeneralRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 5:59
mveOriginalGriff10-Dec-16 5:59 
GeneralRe: C# SQL Server problem Pin
Pavlex410-Dec-16 6:04
Pavlex410-Dec-16 6:04 
GeneralRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 6:23
mveOriginalGriff10-Dec-16 6:23 
And there is your problem: those are not Unicode strings: they are VARCHAR strings, which are basically ASCII and hold eight bit characters instead of 16 bit Unicode values. NVARCHAR strings are prefixed with N:
SQL
INSERT INTO table1 (Reci) VALUES (N'заступниство');

Do yourself couple of favours as well:
1) Add two more columns to your table:
SQL
CREATE TABLE table1
(
ID [INT] IDENTITY(1,1) NOT NULL,
Reci nvarchar(13) NOT NULL,
WordLen INT NOT NULL
);
Storing the word length once is a lot more efficient than processing the string length twice each time you want to retrieve it, for a minimal extra storage overhead.
2) If you only want one word, only retrieve one word:
SQL
SELECT TOP 1 Reci FROM Table1 ...
Otherwise you fetch all records that match, wether you need them or not.
3) Get into the habit of listing the columns you are going to insert / select - it can save a lot of frustration later when you accidentally insert to the wrong columns because you forgot the order...
4) SqlCommand objects should also be Disposed, not just SqlConnections.
5) Don't hard code connection strings - store them in a settings file so you don't have to recompile to change the DB source.
6) Be aware that ATTACH is a special "developer" mode: you should normally let SQL handle the DB completely, and not try to ATTACH it. ATTACH only works in Express editions for just that reason...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: C# SQL Server problem Pin
Pavlex410-Dec-16 6:49
Pavlex410-Dec-16 6:49 
GeneralRe: C# SQL Server problem Pin
OriginalGriff10-Dec-16 7:28
mveOriginalGriff10-Dec-16 7:28 
QuestionC# Check if textbox value exists in SQL server database Pin
Pavlex410-Dec-16 2:31
Pavlex410-Dec-16 2:31 
AnswerRe: C# Check if textbox value exists in SQL server database Pin
Wendelius10-Dec-16 2:40
mentorWendelius10-Dec-16 2:40 
GeneralRe: C# Check if textbox value exists in SQL server database Pin
Pavlex410-Dec-16 4:16
Pavlex410-Dec-16 4:16 
GeneralRe: C# Check if textbox value exists in SQL server database Pin
PIEBALDconsult10-Dec-16 4:22
mvePIEBALDconsult10-Dec-16 4:22 
AnswerRe: C# Check if textbox value exists in SQL server database Pin
Wendelius10-Dec-16 5:18
mentorWendelius10-Dec-16 5:18 
QuestionC# Textbox Pin
Pavlex49-Dec-16 6:57
Pavlex49-Dec-16 6:57 
AnswerRe: C# Textbox Pin
Michael_Davies9-Dec-16 7:03
Michael_Davies9-Dec-16 7:03 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 7:06
Pavlex49-Dec-16 7:06 
GeneralRe: C# Textbox Pin
Michael_Davies9-Dec-16 7:29
Michael_Davies9-Dec-16 7:29 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 7:41
Pavlex49-Dec-16 7:41 
GeneralRe: C# Textbox Pin
Eddy Vluggen9-Dec-16 8:01
professionalEddy Vluggen9-Dec-16 8:01 
GeneralRe: C# Textbox Pin
Michael_Davies9-Dec-16 8:23
Michael_Davies9-Dec-16 8:23 
AnswerRe: C# Textbox Pin
Gerry Schmitz9-Dec-16 8:26
mveGerry Schmitz9-Dec-16 8:26 
AnswerRe: C# Textbox Pin
OriginalGriff9-Dec-16 8:27
mveOriginalGriff9-Dec-16 8:27 
GeneralRe: C# Textbox Pin
Pavlex49-Dec-16 22:06
Pavlex49-Dec-16 22:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.