I face the following error frequently ,when i try to authenticate users :
ERROR [HY000] [Informix .NET provider]Inexact character conversion during translation.
 public static int IsValidPortalUser(string p_u, string p_p)
        {
            int ret = 0;
            using (IfxConnection conn = new IfxConnection(connectionString))
            {
                IfxCommand DBCmd = new IfxCommand();
                String p = My_Decryption_2(p_p);
                try
                {
                    if (conn.State == ConnectionState.Closed)
                        conn.Open();
                    DBCmd = new IfxCommand();
                    DBCmd.Connection = conn;
                    DBCmd.CommandText = "SELECT nvl(emp_num,0) FROM emp_mas_queue WHERE username = ? AND DECRYPT_CHAR(password, 'XXXXXX') = ? ";
                    DBCmd.Parameters.Add("user_name", p_u);
                    DBCmd.Parameters.Add("password", p);
                    using (IfxDataReader dataReader = DBCmd.ExecuteReader())
                    {
                        if (dataReader.Read())
                        {
                            if (dataReader[0] != null && !string.IsNullOrEmpty(dataReader[0].ToString()))
                            {
                                ret = int.Parse(dataReader[0].ToString());
                            }
                        }
                        dataReader.Close();
                    }
                }
                catch (ThreadAbortException e)
                {
                }
                catch (ApplicationException e)
                {
                }
                conn.Close();
                return ret;
            }
        }
I believe this may be a problem with encoding.
I located this article (translated through google translate)
link
It is typically caused by people copy+pasting their details from a source with differing encoding. Try converting the string to whichever codepage you are using before processing them.
As this is the only place in stackoverflow where this error is mentionned, I will add that I resolved a similar problem by specifying DB_LOCALE et CLIENT_LOCALE at the connection string level, making sure the two were identical and correponding to the Database DB_LOCALE.
Modifying environnment variables was not working.
I must say it was on a Windows 10 system with the following client version: clientsdk.4.10.TC6DE.WIN
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With