Quantcast
Channel: Oracle, MySQL, Sybase, Informix and other databases
Viewing all articles
Browse latest Browse all 1350

Problems with querys in my project

$
0
0

Good afternoon guys, I have the following problem: I need to insert my vouchers into the oracle database, but first I need to find the process and the interested one by the barcode in the database: In the database I can find using this query:

--So far so good.

select * from sdpj_proc_inter where cod_bars_banestes = 'HERE INFORMATION OR NUME OF CODE OF BARS'

But the problem is that the query in my code, which is not working, follows the code.

/ Search Bar Code (codBarra = comes from the line of the file, therefore I will use to find the process and interested and insert).
                 string CodProcInter = GetCodProcInter (CodBar);

In the above code I'm calling the GetCodProcInte method r, follow the code below regarding the method:

private static string GetCodProcInter (string CodBar)
        {
            using (DB db = new DB ())
            {
                // string SQL = string.Format (@ "SELECT T0.COD_PROC_INTER FROM sdpj_proc_inter T0 WHERE T0.COD_BARS_BANESTES = {0}", CodBar);
                // string SQL = string.Format (@ "SELECT count (T0.COD_COMP_BANESTES) FROM SDPJ_COMP_BANESTES T0 WHERE T0.COD_COMP_BANESTES = '{0}'", CodBar);
              // My query is not working.
                string SQL = string.Format (@ "SELECT count (T0.COD_COMP_BANESTES) QUANTITY FROM SDPJ_COMP_BANESTES T0 WHERE T0.COD_COMP_BANESTES = '{0}'", CodBar);


                var data = db.ExecuteCommandCommission (SQL);

                if (data.Read ())
                {
                    // return data ["COD_PROC_INTER"]. ToString ();
                    return data ["QUANTITY"]. ToString ();
                }
            }

            return "";
        }

What am I doing wrong?


Viewing all articles
Browse latest Browse all 1350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>