2

我有一个文本框,我想将输出结果保存为Unicodenvarchar在 SQL Server 中),对于我使用实体框架的保存操作,我的代码工作正常,我的问题只是将文本框结果转换为 Unicode,因为当我将结果保存为“?” 在 Sql 服务器中。注意:我使用阿拉伯字母。,这是我的代码,列定义: 代码

//Button add new car into database
    private void BtnAddNewCar_Click(object sender, EventArgs e)
    {
        v.brand = TxBoxBrand.Text;
        v.car_number = TxBoxCarNumber.Text;//Text Box that i want to convert to Unicode (Arabic letters)
        v.color = CmBoxColorPicker.Text;
        v.model = TxBoxModel.Text;
        v.picture = ImageToByteArray(filename);
        v.cin_driver= CmBoxCarOwner.Text;
        context.Vehicles.Add(v);
        context.SaveChanges();
        NotifyWelcome.ShowBalloonTip(1000, "The vehicle " + TxBoxBrand.Text + " was successfully added", " Have a ice drive", ToolTipIcon.Info);
        CarClear();
        VLoad.Enabled = true;
        CmVLoad.Enabled = false;
        MyMessageBox.ShowBox("The vehicle " + TxBoxBrand.Text + " as successfully added", "Notify");
    }

列定义

// TxBoxCarNumber
        // 
        this.TxBoxCarNumber.Font = new System.Drawing.Font("Ubuntu", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.TxBoxCarNumber.Location = new System.Drawing.Point(272, 30);
        this.TxBoxCarNumber.Name = "TxBoxCarNumber";
        this.TxBoxCarNumber.Size = new System.Drawing.Size(142, 21);
        this.TxBoxCarNumber.TabIndex = 0;
        this.TxBoxCarNumber.TabStop = false;
4

0 回答 0