Search code examples
c#winformsdatagridviewtableadaptercyrillic

TableAdapter.Update(DataSet) makes cyrillic letters appear as question marks in dgv


I have an application that consists of a DataGridView and a few buttons to manage it more easily (it is about managing gym subscriptions). I add the row to the DataGridView like this.

DataTable dataTable = ((SubscriptionsDatabaseDataSet)(tableBindingSource.DataSource)).Tables[0];
dataTable.Rows.Add(new object[] {id, name, dateMade, expiryDate, daysRemaining, sessionsRemaining, cardType});

and after that, in order to save the data to the database I do this:

this.tableTableAdapter.Update(this.subscriptionsDatabaseDataSet);
this.tableTableAdapter.Update(this.subscriptionsDatabaseDataSet.Table);

The card type is in cyrillic and it appears fine if I do not call tableTableAdapter.Update(), it only gets broken and appears as question marks after I call the method.


Solution

  • Q: What's the data type of the column in database?
    A: VARCHAR (MAX).

    You should change the type of the column to NVARCHAR(MAX) to support variable length unicode data.