Announcement

Collapse
No announcement yet.

Quick Search error when link to other table

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Quick Search error when link to other table

    I have 2 table Propinsi and Kota. I create grid for Kota table where links to Propinsi table. But I found error when running Quick Search. I have tried to find out what makes it error. Do I miss something ? I am sure this is bug.
    propinsi table.PNGKota table.PNGGrid Kota.PNGQuick Search Error.PNG
    Last edited by ali.dewanto; 02-11-2015, 02:13 AM.

  • #2
    Look at lines 1940-1950 at your code post this here ...
    Best regards: - Reinhard -

    I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

    Comment


    • #3
      I don't write any coding, just default from SC8.

      Comment


      • #4
        Yes ... Post that code and we will see, what is wrong.
        Best regards: - Reinhard -

        I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

        Comment


        • #5
          This is the code. I took from line 1921 up to 2002, since it is a function.

          function SC_lookup_kot_prp_sn_fk($condicao, $campo)
          {
          $result = array();
          $nm_comando = "SELECT prp_propinsi, prp_sn_pk FROM 900_propinsi_prp WHERE (prp_propinsi LIKE '%$campo%')" ;
          if ($condicao == "ii")
          {
          $nm_comando = str_replace("LIKE '%$campo%'", "LIKE '$campo%'", $nm_comando);
          }
          if ($condicao == "df" || $condicao == "np")
          {
          $nm_comando = str_replace("LIKE '%$campo%'", "NOT LIKE '%$campo%'", $nm_comando);
          }
          if ($condicao == "gt")
          {
          $nm_comando = str_replace("LIKE '%$campo%'", "> '$campo'", $nm_comando);
          }
          if ($condicao == "ge")
          {
          $nm_comando = str_replace("LIKE '%$campo%'", ">= '$campo'", $nm_comando);
          }
          if ($condicao == "lt")
          {
          $nm_comando = str_replace("LIKE '%$campo%'", "< '$campo'", $nm_comando);
          }
          if ($condicao == "le")
          {
          $nm_comando = str_replace("LIKE '%$campo%'", "<= '$campo'", $nm_comando);
          }
          $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando;
          $_SESSION['scriptcase']['sc_sql_ult_conexao'] = '';
          if ($rx = $this->Ini->nm_db_conn_PropertiApps->Execute($nm_comando))
          {
          while (!$rx->EOF)
          {
          $chave = $rx->fields[1];
          $label = $rx->fields[0];
          if ($condicao == "eq" && $campo == $label)
          {
          $result[] = $chave;
          }
          if ($condicao == "ii" && $campo == substr($label, 0, strlen($campo)))
          {
          $result[] = $chave;
          }
          if ($condicao == "qp" && strstr($label, $campo))
          {
          $result[] = $chave;
          }
          if ($condicao == "np" && !strstr($label, $campo))
          {
          $result[] = $chave;
          }
          if ($condicao == "df" && $campo != $label)
          {
          $result[] = $chave;
          }
          if ($condicao == "gt" && $label > $campo )
          {
          $result[] = $chave;
          }
          if ($condicao == "ge" && $label >= $campo)
          {
          $result[] = $chave;
          }
          if ($condicao == "lt" && $label < $campo)
          {
          $result[] = $chave;
          }
          if ($condicao == "le" && $label <= $campo)
          {
          $result[] = $chave;
          }
          $rx->MoveNext() ;
          }
          return $result;
          }
          elseif ($GLOBALS["NM_ERRO_IBASE"] != 1)
          {
          $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Ini->nm_db_conn_PropertiApps->ErrorMsg());
          exit;
          }
          }

          Comment


          • #6
            Please show the SQL select statements for the grids ...
            Best regards: - Reinhard -

            I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

            Comment


            • #7
              Here it is.

              SELECT
              kot_sn_pk,
              kot_usr_sn_fk,
              kot_prp_sn_fk,
              kot_kota
              FROM
              900_kota_kot
              WHERE
              kot_usr_sn_fk = [usr_sn_pk]

              Comment


              • #8
                Aparently this: $this->Ini->nm_db_conn_PropertiApps is not created. Hence the error. It says that the Execute is going wrong since the point that the thing before the execute is not an object where it should be. So your error is before that. Check if the database connection is properly made.

                Comment


                • #9
                  I have set the connection
                  connection.PNG

                  Comment


                  • #10
                    Maybe an odd question but did you test your connection? Do you have a seperate program (e.g. mysql workbench or so) wuth which you can verify that your settings are correct?

                    Comment


                    • #11
                      Connection is no problem since other menus run smoothly.

                      Comment


                      • #12
                        Connection is no problem since other menus run smoothly.

                        Comment


                        • #13
                          OK. Solved already. SQL syntax needs to be changed.
                          Thank you all.

                          Comment


                          • #14
                            Originally posted by ali.dewanto View Post
                            OK. Solved already. SQL syntax needs to be changed.
                            Thank you all.
                            Hi - can you explain what that SQL syntax issue was? I am getting the same type of error and have not been able to resolve.


                            Thanks!

                            Comment

                            Working...
                            X