I am building (I thought) a simple flash card program to help me learn Spanish. That is, English to Spanish, or flip to Spanish to English. I am using C# and SQL Server. The code is working fine except that I'm struggling to figure out how to work with the Spanish diacritical marks like "á, é, í, ó, ú, ñ". Specifically, while I can enter them into my prep Excel spreadsheet using the win10 special keyboard, and they display correctly, when I load them into my SQL Sever database, and access via VS C# Winforms program, they display incorrectly.
I have tried using nvarchar
instead of varchar
, and that just loads and displays these characters in a stranger format.
I have tried switching my default keyboard to Spanish but that totally switched me to Spanish. Also, note that when I work with them with Note++ they show correctly.
When I process them in c# they input correctly, but when processed with StreamWriter
they don't. Before I load the Excel .csv
data into a database, I process each to add some additional columns.
using (StreamReader reader = new StreamReader(File.OpenRead(INFILE)))
{
using (StreamWriter writer = new StreamWriter(File.Open(OUTFILE, FileMode.Create)))
{
while ((sLineIn = reader.ReadLine()) != null) // Process each input record until no more
{
iRecIn++; // Count input records
if (bFirstRecord)
{
iRecOut++; // Account for title line
bFirstRecord = false; // Skip first record
continue;
}
sLineOut = processLineOut(sLineIn);
writeTheRecord(writer);
continue;
}
}
}
I just plain don't know where to go next. Thanks!!
Part-2: My process is as follows:
- Flash card data is entered into a general Excel 2016 file. One card per line as you can see in pic.
- I save this file as a csv file.
- Since my database table has an additional 10+ columns, I have a separate c# program that uses the just created csv file, and adds the remaining columns via the StreamReader/StreamWriter process. See the code snippet. The output file is also a csv file.
- I run my sql server job that uses bulk insert to load the output from step 3 to the database.
- I use my c# winform flashcard program to flash the card deck.
Regarding the database table, column is defined as: SpanWord varchar(100),
I switched it back from : SpanWord nvarchar(100),
since that wasn't working either.... Thanks
Part-3: I agree this is too vague and not concise. I will break it up into parts and work on each of them. Then move through the process.
I don't believe I can close this question so if someone with proper authority, please close this for me... Thanks again! I have enough to work on.