示例#1
0
        public void GetRcv(System.Windows.Forms.ListView lv)
        {
            try
            {
                MySqlDataReader dReader;
                MySqlCommand    sCmd = new MySqlCommand();

                RData MyConn = new RData();
                sCmd.Connection  = MyConn.GetConn();
                sCmd.CommandText = "select * from ras_core_receivers";

                dReader = sCmd.ExecuteReader();

                while (dReader.Read())
                {
                    ListViewItem mItem = new ListViewItem();
                    mItem.Text = dReader[0].ToString();
                    mItem.SubItems.Add(dReader[1].ToString());
                    mItem.SubItems.Add(dReader[2].ToString());
                    mItem.SubItems.Add(dReader[3].ToString());
                    mItem.SubItems.Add(dReader[4].ToString());
                    mItem.SubItems.Add(dReader[5].ToString());
                    lv.Items.Add(mItem);
                }
                return;
            }
            catch (MySqlException ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
                return;
            }
        }
示例#2
0
        public int GetOldCode(int NewCode)
        {
            MySqlConnection con;
            MySqlCommand    mCmd = new MySqlCommand();
            int             ret;

            try
            {
                RData MyConn = new RData();
                con = MyConn.GetConn();

                string SQL = "select oldcode from zonecodes where newcode=" + NewCode;
                mCmd.Connection  = con;
                mCmd.CommandText = SQL;
                ret = int.Parse(mCmd.ExecuteScalar().ToString());
                con.Close();
                return(ret);
            }
            catch
            {
                return(0);
            }
        }
示例#3
0
        public bool Add_lp_Event(string Code, int Zone, int EvtCode, string Desc)
        {
            MySqlConnection con;
            MySqlCommand    mCmd = new MySqlCommand();

            try
            {
                RData MyConn = new RData();
                con = MyConn.GetConn();

                string SQL = "insert into usl_events_low_pr values('" + Code + "'," +
                             Zone + ", getdate()," + EvtCode + ",'" + Desc + "')";
                mCmd.Connection  = con;
                mCmd.CommandText = SQL;
                mCmd.ExecuteNonQuery();
                con.Close();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
示例#4
0
        public int getEvtCode(string Code, string Zone)
        {
            MySqlConnection con;
            MySqlCommand    mCmd = new MySqlCommand();
            int             ret;

            try
            {
                RData MyConn = new RData();
                con = MyConn.GetConn();

                string SQL = "select zone" + Zone + " from usl_event_codes where code = '" +
                             Code + "'";
                mCmd.Connection  = con;
                mCmd.CommandText = SQL;
                ret = int.Parse(mCmd.ExecuteScalar().ToString());
                con.Close();
                return(ret);
            }
            catch
            {
                return(0);
            }
        }