private void setFieldTypes()
        {
            int n = objRet.FieldCount;

            if (n > 0 && _currentFields != null)
            {
                for (int i = 0; i < n; i++)
                {
                    EPField f = objRet.GetField(i);
                    EPField p = _currentFields[f.Name];
                    if (p != null)
                    {
                        f.OleDbType = p.OleDbType;
                    }
                }
                int m = objRet.ParamCount;
                if (m > 0)
                {
                    for (int i = 0; i < m; i++)
                    {
                        EPField f0 = null;
                        EPField p  = objRet.Parameters[i];
                        for (int j = 0; j < n; j++)
                        {
                            EPField f = objRet.GetField(j);
                            if (!string.IsNullOrEmpty(f.FieldText))
                            {
                                if (string.Compare(f.FieldText, p.Name, StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    f0 = f;
                                    break;
                                }
                                if (f0 == null)
                                {
                                    if (f.FieldText.Contains(f.Name))
                                    {
                                        f0 = f;
                                    }
                                }
                            }
                        }
                        if (f0 != null)
                        {
                            p.OleDbType = f0.OleDbType;
                        }
                    }
                }
            }
        }
        private bool checkSyntax()
        {
            if (bSQLChanged)
            {
                QueryParser._UseLowerCase = dbConn.LowerCaseSqlKeywords;
                SQLNoneQuery sql = new SQLNoneQuery();
                sql.SetConnection(dbConn);
                ParameterList ps = objRet.ParseParams();
                if (ps != null)
                {
                    sql.SetParameters(ps);
                }
                if (parseSQLNoneQuery(txtSQL.Text, sql))
                {
                    string tblName = objRet.TableName;
                    objRet = sql;
                    if (string.IsNullOrEmpty(objRet.TableName))
                    {
                        objRet.TableName = tblName;
                    }

                    enmNonQueryType qt = enmNonQueryType.Insert;
                    if (cbxType.SelectedIndex >= 0)
                    {
                        qt = (enmNonQueryType)(cbxType.SelectedIndex);
                    }
                    if (qt != objRet.CommandType)
                    {
                        cbxType.SelectedIndex = (int)qt;
                    }
                    for (int i = 0; i < lstTable.Items.Count; i++)
                    {
                        if (string.Compare(objRet.TableName, lstTable.Items[i].ToString(), StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            if (i != lstTable.SelectedIndex)
                            {
                                lstTable.SelectedIndex = i;
                                EnumEditState st = editState;
                                editState = EnumEditState.Ready;
                                lstTable_SelectedIndexChanged(this, EventArgs.Empty);
                                editState = st;
                            }
                            break;
                        }
                    }
                    setFieldTypes();
                    saveTocCache();
                    if (ds != null)
                    {
                        for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                        {
                            ds.Tables[0].Rows[j][1] = false;
                            ds.Tables[0].Rows[j][2] = "";
                        }
                        for (int i = 0; i < objRet.FieldCount; i++)
                        {
                            EPField f = objRet.GetField(i);
                            if (f != null)
                            {
                                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                                {
                                    string fn = ds.Tables[0].Rows[j][0].ToString();
                                    if (string.Compare(f.Name, fn, StringComparison.OrdinalIgnoreCase) == 0)
                                    {
                                        ds.Tables[0].Rows[j][1] = true;
                                        ds.Tables[0].Rows[j][2] = f.FieldText;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    return(true);
                }
                else
                {
                    txtSQL.ForeColor = System.Drawing.Color.Red;
                    return(false);
                }
            }
            return(true);
        }