【发布时间】:2014-06-20 02:29:18
【问题描述】:
数据库中的希腊字符就像问号(“?????”)。我找不到解决方案。当我在 MySQL 中插入希腊字母时,就像问号一样。 mysql中talbe中的Tha排序规则是utf8。
我做错了什么?
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
int col = this.dataGridView1.CurrentCell.ColumnIndex;
int row = this.dataGridView1.CurrentCell.RowIndex;
if (e.ColumnIndex == dataGridView1.Columns["priceoneDataGridViewTextBoxColumn"].Index)
{
string name = dataGridView1.Rows[row].Cells[col - 1].Value.ToString();
string pric= dataGridView1.Rows[row].Cells[col].Value.ToString();
//in this row i am getting the line ok
MessageBox.Show(name);
MessageBox.Show(pric);
lawyerspriceDataSet ds = new lawyerspriceDataSet();
lawyerspriceDataSetTableAdapters.reportTableAdapter daReport = new lawyerspriceDataSetTableAdapters.reportTableAdapter();
daReport.Fill(ds.report);
try
{
daReport.Insert(name, pric); //i save the info in the table
}
catch (Exception ex)
{
MessageBox.Show("error");
}
}
![enter image description here][1]
【问题讨论】:
-
这里描述了您的问题的解决方案:stackoverflow.com/questions/1385994/…
-
我无法在我的代码中找到放置 charset=utf8 的位置
-
您应该将其添加到连接字符串中。它可能位于您的 winforms 应用程序的 app.config 文件中。
-
server=kosh-PC;User Id=root;database=lawyersprice;Persist Security Info=True;Character Set=utf8 。我成功了,但还是不行
-
你试过 CharSet=utf8 吗?
标签: c# mysql datagridview grammar