Good afternoon guys, I have an application in C # with SQL Server database, the problem is that words that have accented letters, instead of those letters appear lozenges with a question mark in the middle as in the image below, when I enter and change words do not give this error, this is only happening with words with accented letters that already exist in the bank. Can you help me?
Thank you in advance. Hugs
Well,I'musinglayeredprogramming,theLayerstemplate,whichiswheretheclassis,theDALlayer,whichiswheretheconnectiontothebankis,theBLLlayer,whichiswherethebusinessruleis,andendtheUIWindowslayer,whichiswherethecodeoftheformworkslikebuttoncodes,griddisplayandsoon.BelowIwillpostonlythequeryexcerptoftheDAL,BLLandUIWindowslayers,theModelsisirrelevantbecauseitonlystorestheattributesoftheclass.
Templates:
namespaceBiblioteca.Modelos{publicclassCddModelos{privatestring_codigoCdd;publicstringCodigoCdd{get{return_codigoCdd;}set{_codigoCdd=value;}}privatestring_descricaoCdd;publicstringDescricaoCdd{get{return_descricaoCdd;}set{_descricaoCdd=value;}}}}
DAL:
publicDataTableListagem_cdd(){DataTabletabela=newDataTable();SqlDataAdapterda=newSqlDataAdapter("SELECT * FROM Cdd", Dados.StringDeConexao);
da.Fill(tabela);
return tabela;
}
BLL:
public DataTable Listagem_cdd()
{
CddDAL obj = new CddDAL();
return obj.Listagem_cdd();
}
UIWindows:
//Método parra carregar o grid
public void AtualizaGridCdd()
{
// Comunicação com a Camada BLL
CddBLL obj = new CddBLL();
dataGridViewCdd.DataSource = obj.Listagem_cdd();
dataGridViewCdd.Columns[0].HeaderText = "Código";
dataGridViewCdd.Columns[1].HeaderText = "Descrição";
// Atualizando os objetos TextBox
textBoxCodigo_cdd.Text = dataGridViewCdd[0, dataGridViewCdd.CurrentRow.Index].Value.ToString();
textBoxDescricao_cdd.Text = dataGridViewCdd[1, dataGridViewCdd.CurrentRow.Index].Value.ToString();
}
private void dataGridViewCdd_CellClick(object sender, DataGridViewCellEventArgs e)
{
dataGridViewCdd.Columns[0].HeaderText = "Código";
dataGridViewCdd.Columns[1].HeaderText = "Descrição";
// Atualizando os objetos TextBox
textBoxCodigo_cdd.Text = dataGridViewCdd[0, dataGridViewCdd.CurrentRow.Index].Value.ToString();
textBoxDescricao_cdd.Text = dataGridViewCdd[1, dataGridViewCdd.CurrentRow.Index].Value.ToString();
}