Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi gays

I am bound to Dbf file by the below code and store my information

C#
public int save_dbf_func(string source_dbf, string str_command)
{
    try
    {
        OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + source_dbf + ";Extended Properties=dBASE IV;User ID=;Password=;"); // give your path directly
        OleDbCommand Cmd = new OleDbCommand();

        if (con.State == ConnectionState.Closed) con.Open();
        Cmd.CommandText = str_command;
        Cmd.Connection = con;
        int RowEffect = Cmd.ExecuteNonQuery();
        con.Close();
        return RowEffect;
    }
    catch (Exception ex)
    {
        var mm = ex.ToString();
        return -1;
    }
}


for example :

C#
save_dbf_func("c:\folder", "insert into file.dbf (fName , lName) values ('مرتضی' , 'زند')")


And by a dll convert my string to Iranian system codePage for example:

C#
CONVERTLib.ConvertorClass convert_dll = new CONVERTLib.ConvertorClass();

    textBox1.Text = convert_dll.WinToIran('مرتضی');



converted string into the textbox is correct but when I store the string in the Dbf file for most characters show ???? ??? ?????.

Please guide me how to make the information stored in the database that they are not damaged.

Thanks
Posted
Comments
majid1364teh 14-Aug-14 6:47am    
Salam ... Moshkelet Hal shod??

1 solution

SQL
سلام شما dbf خودتون رو به صورت انگلیسی set کردین.
save_dbf_func("c:\folder", "insert into file.dbf (fName , lName) values ('N"مرتض"' , '"زند"')");
برای مرتضی هم حرف N رو بذارید
 
Share this answer
 
Comments
Member 10622936 3-Mar-14 4:37am    
سلام مهدی جان
از توجهتون به سوالم خیلی ممنونم
با توجه به اینکه رشته باید به صورت زیر در فایل ذخیره بشه آیا باز هم نیاز هست که کاراکتر N رو اضافه کنم ؟

,¢ّ“î §‘‏ ù¤‘ً÷ –î¤ھ ,
Please use English to communicate in forums.
m-e-h-d-h-i 3-Mar-14 4:50am    
بله باید از این روش استفاده کنید
Please use English to communicate in forums.
majid1364teh 14-Aug-14 6:46am    
سلام ... من هم اين مشكل رو دارم ... ميشه راهنماييم كنيد
از صحبت هاتون چيزي متوجه نشدم

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900