Exemple #1
0
        public CTechIndex get_techIndex(string cmd_str)
        {
            CTechIndex    techIndex = null;
            SqlConnection sqlCn     = null;

            try
            {
                sqlCn = new SqlConnection(_con_str);
                sqlCn.Open();

                SqlCommand cmdSelect = new SqlCommand(cmd_str, sqlCn);
                using (SqlDataReader dr = cmdSelect.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        techIndex        = new CTechIndex();
                        techIndex.id     = (int)dr["id"];
                        techIndex.dutyid = ToInt(dr["dutyid"]);
                        techIndex.ids    = dr["ids"].ToString();

                        break;
                    }
                }
            }
            catch (System.Exception e)
            {
                insert_file(e.ToString());
                insert_file("method=execute_command,time=" + DateTime.Now.ToString() + ",cmd_str=" + cmd_str);
            }
            finally
            {
                close_connection(sqlCn);
            }

            return(techIndex);
        }
Exemple #2
0
        public CTechIndex get_techIndex(string cmd_str)
        {
            CTechIndex techIndex = null;
            SqlConnection sqlCn = null;

            try
            {
                sqlCn = new SqlConnection(_con_str);
                sqlCn.Open();

                SqlCommand cmdSelect = new SqlCommand(cmd_str, sqlCn);
                using (SqlDataReader dr = cmdSelect.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        techIndex = new CTechIndex();
                        techIndex.id = (int)dr["id"];
                        techIndex.dutyid = ToInt(dr["dutyid"]);
                        techIndex.ids = dr["ids"].ToString();

                        break;
                    }
                }

            }
            catch (System.Exception e)
            {
                insert_file(e.ToString());
                insert_file("method=execute_command,time=" + DateTime.Now.ToString() + ",cmd_str=" + cmd_str);
            }
            finally
            {
                close_connection(sqlCn);
            }

            return techIndex;
        }