0
Good afternoon guys, I have a C# application with SQL Server database, the problem is that words that have accented letters, in place of these letters appear lozenges with a question mark in the middle as in the image below, when I insert and change words not from this error, this is only happening with words with accented letters that already exist in the bank. Can help me?
Thanks in advance. Hug
Well, I’m using layered programming, the Models layer, which is where the class is, the DAL layer, which is where the connection to the bank is, the BLL layer, which is where the business rule is and finally the Uiwindows layer, which is where the code for how the form works is located, such as button codes, grid display, etc. Below I will post only the query snippet of the DAL, BLL and Uiwindows layers, the Templates is irrelevant because it only stores the class attributes.
Models:
namespace Biblioteca.Modelos
{
public class CddModelos
{
private string _codigoCdd;
public string CodigoCdd
{
get { return _codigoCdd; }
set { _codigoCdd = value; }
}
private string _descricaoCdd;
public string DescricaoCdd
{
get { return _descricaoCdd; }
set { _descricaoCdd = value; }
}
}
}
DAL:
public DataTable Listagem_cdd()
{
DataTable tabela = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("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();
}
Your application uses which encoding? The database is in which encoding?
– Leonel Sanches da Silva
The database is using Latin1_general_ci_as encoding and I do not have sql server permissions to change. The application is not specified.
– Lucas Barbosa Fonseca
http://answall.com/questions/74567/problema-de-acentua%C3%A7%C3%A3o-ao-recuperar-registros-no-sql-server? Rq=1
– user60252
Post the routine that fills the datagrid to better help you. What data access technology are you using?
– Ismael
I will edit the question @Smael , thank you very much!
– Lucas Barbosa Fonseca
Aah, the data access technology I’m using is sgbd SQL Server
– Lucas Barbosa Fonseca