using wchar_t and C/Front

Hi, I want to use wchar_t, but if I use the function DBL_InsertRec(hTable,hRec) Navision throws an Error like this: ------------------------------------------------------ Die Konstante muß in Typ und Länge mit Feld name übereinstimmen. Typ: Text50 ← Text Feld: name ← Mustermann, Manfred Tabelle: Test ------------------------------------------------------ OK Please help me???

I have never used the CFront DLL (onlyh OCX) but i can think of 2 posible causes: 1. You may need a fixed size variable because navision table fields are fixed too. Here you are using a variable size variable. 2. You could try using a BSTR variable instead of wchar_t, most time i use this type for passing text vars with COM but i can’t tell that this works for navision.

If i may make a suggestion try using visual basic. I see all your threads about basic VC++ problems and conclude that you are not very experienced. VC++ is rather hard to understand. I think VB will cause 10 times less trouble as it is much more foregiving. And i don’t think you will be cut back on possibilities in this case.

You cannot use wchar_t with any C/FRONT functions! This type represents a Unicode (wide) string whereby all characters occupy 2 bytes, not 1. All strings in C/FRONT are 1 byte unsigned char. If you have Unicode strings in wchar_t variables or pointers, you must convert them to OEM (and back) using WideCharToMultiByte() and MultiByteToWideChar(). Don’t do any of this though if you don’t fully understand Unicode, ANSI, OEM and DBCS character strings in C.

My Problem is, that I have a mySQL Database with Unicode Characters und I write the Information from the mySQL Database with a mySQL++ API and C/Front to Navision. So I must find a Solution that all German-Umlauts can represented correctly in Navision. Do you have an easier idea?

Why chars is bad for you ? Use German char set, if they are different use conversion.

I use the functions OemToChar in my tool to convert the MySQL chars to Navision chars and now all German chars, e.g. Ä, Ü, Ö, … represented correctly in Navision.