当我在文本框中插入时,阿拉伯语字符被保存为" ????"

时间:2015-04-08 22:22:14

标签: c#

当我在文本框中插入时,阿拉伯语字符保存为????

我不知道为什么,这是源代码

我必须将textbox2.texttextbox3.text保存为阿拉伯字符

private void button1_Click(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection(@"Data Source=WIN-6Q836P8JQ1C\oby;Initial Catalog=Etudiant;Integrated Security=True");

    string query = "insert into etudiant(CIN, ID_NV, ID_SEC, Nom, Prenom, ID_CLA, Date_Naissance, Num_Tel, Email) values('" + textBox1.Text + "','" + comboBox1.SelectedValue + "','" + comboBox2.SelectedValue + "','" + textBox2.Text + "','" + textBox3.Text + "','" + comboBox3.SelectedValue + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "');";

    SqlCommand cmd = new SqlCommand(query, con);
    SqlDataReader rd;

    try
    {
        con.Open();
        rd = cmd.ExecuteReader();
        MessageBox.Show("OK");

        while (rd.Read()) { }
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }

    textBox1.Clear();
    textBox2.Clear();
    textBox3.Clear();
    textBox4.Clear();
    textBox5.Clear();
}

0 个答案:

没有答案