예제 #1
0
        public static Double DVal(String D_Desig_In)
        //==========================================
        {
            //....Returns Diameter in inch.
            clsDB pDB = new clsDB();
            //BearingDBEntities pBearingDBEntities = new BearingDBEntities();
            Double pD = 0.0F;


            if (D_Desig_In != null)
            {
                string pstrFIELDS, pstrFROM, pstrSQL, pstrWHERE, pstrORDERBY;

                OleDbConnection pConnection = null;
                pstrFIELDS  = "Select D";
                pstrFROM    = " FROM [Drill$]";
                pstrWHERE   = " WHERE  D_Desig = '" + D_Desig_In + "'";
                pstrORDERBY = " Order by D ASC";

                pstrSQL = pstrFIELDS + pstrFROM + pstrWHERE + pstrORDERBY;

                OleDbDataReader pobjDR = null;
                pobjDR = modMain.gDB.GetDataReader(pstrSQL, modMain.gFiles.FileTitle_EXCEL_StdToolData, ref pConnection);

                if (pobjDR.Read())
                {
                    pD = pDB.CheckDBDouble(pobjDR["D"]);
                }
                else if (!D_Desig_In.Contains("/"))
                {
                    pD = modMain.ConvTextToDouble(D_Desig_In);
                }

                pobjDR.Dispose();
                pConnection.Close();

                //var pProject = (from pRec in pBearingDBEntities.tblManf_Drill where pRec.fldD_Desig == D_Desig_In select pRec.fldD).ToList();
                //if (pProject.Count > 0)
                //    pD = pDB.CheckDBDouble(pProject[0]);
                //else if (!D_Desig_In.Contains("/"))
                //    pD = modMain.ConvTextToDouble(D_Desig_In);
            }
            return(pD);
        }