hi
I am try to insert data from TextBox to db using TableAdapter, when i insert Arabic language in TextBox and send it to DB it looks like this "????????" what does that means? how can i solve this problem?
When i insert English words it works fine

this is my Code :

            if (!UserNameTextBox.Text.Trim().Equals(""))
            {
                errorProvider1.Clear();

                if (!PasswordTextBox.Text.Trim().Equals(""))
                {
                    errorProvider2.Clear();

                    if (!RePasswordTextBox.Text.Trim().Equals(""))
                    {
                        errorProvider3.Clear();

                        try
                        {
                            this.selectUserTableAdapter1.Fill(landsDataSet1.SelectUser, UserNameTextBox.Text.Trim());
                            if (landsDataSet1.SelectUser.Rows.Count > 0)
                            {
                                errorProvider1.SetError(UserNameTextBox, "إسم المستخدم المدخل مستعمل من قبل الرجاء إختيار إسم أخر");
                                return;
                            }
                            else
                            {
                                if (PasswordTextBox.Text.Trim().Equals(RePasswordTextBox.Text.Trim()))
                                {
                                    this.insertUserTableAdapter1.Fill(landsDataSet1.InsertUser, UserNameTextBox.Text.Trim(), PasswordTextBox.Text.Trim());
                                    AlertLabel.ForeColor = Color.Green;
                                    AlertLabel.Text = "لقد تم إضافة مستخدم جديد ";
                                    ResetFields();
                                }
                                else
                                {
                                    errorProvider2.SetError(PasswordTextBox, "كلمة المرور والإعادة غير متساويتين الرجاء التأكد من كلمة المرور");
                                    errorProvider3.SetError(RePasswordTextBox, "كلمة المرور والإعادة غير متساويتين الرجاء التأكد من كلمة المرور");
                                }
                            }
                        }
                        catch (Exception exc)
                        {
                            throw new ArgumentException(exc.Message);
                        }
                    }
                    else
                    {
                        errorProvider3.SetError(RePasswordTextBox, "الرجاء إعادة كلمة المرور");
                    }
                }
                else
                {
                    errorProvider2.SetError(PasswordTextBox, "الرجاء إدخال كلمة المرور");
                }
            }
            else
            {
                errorProvider1.SetError(UserNameTextBox, "الرجاء إدخال إسم المستخدم");
            }

Recommended Answers

All 7 Replies

Did you set your table to accept nvarchar? Arabic text is unicode which is not supported by varchar.

In your qurey use "N" before your field value
e.g "insert into [UrduTextTable] values(N'" + txtUrduString + "')

yes i set all my colums to accept nvarchar not varchar, i think the problem with :
this.insertUserTableAdapter1.Fill(landsDataSet1.InsertUser, UserNameTextBox.Text.Trim(), PasswordTextBox.Text.Trim());

does not accept Aerabic language by default do you think that ?? do you have an idea how to fix it ?

It does not wokr to add N before my value

If you retrieve the data back from the database does it show correctly?

yes it retrive it back correctly

Then the data is stored fine it's just that SQL Management Studio can't display it. Try changing the display font of mssms to a unicode font that can display English and Arabic and it should display fine.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.