示例#1
0
        public int tb_computerLogin(tb_computer compay, int intFalg)
        {
            int intResult = 0;

            try
            {
                getConnection getCon = new getConnection();
                oledCon = getCon.OledCon();
                oledCon.Open();
                string strAdd = null;
                switch (intFalg)
                {
                case 1:
                    strAdd = "select  * from tb_computer  where  cmp_name='" + compay.strcmp_name + "' and cmp_Falg='" + 0 + "'";
                    break;

                case 2:
                    strAdd = "select *  from tb_computer  where cmp_name='" + compay.strcmp_name + "'and cmp_Paww='" + compay.strcmp_Paww + "' and cmp_Falg='" + 0 + "'";
                    break;
                }

                oledcmd = new SqlCommand(strAdd, oledCon);
                oleRed  = oledcmd.ExecuteReader();
                if (oleRed.HasRows)
                {
                    intResult++;
                }
                return(intResult);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
                return(intResult);
            }
        }
示例#2
0
        public int tb_computerDelete(tb_computer compay)
        {
            int intResult = 0;

            try
            {
                getConnection getCon = new getConnection();
                oledCon = getCon.OledCon();
                oledCon.Open();
                string strAdd = "update tb_computer set ";
                strAdd   += "cmp_Falg ='" + compay.cmp_Falg + "' where  cmp_ID='" + compay.cmp_ID + "'";
                oledcmd   = new SqlCommand(strAdd, oledCon);
                intResult = oledcmd.ExecuteNonQuery();
                return(intResult);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
                return(intResult);
            }
        }
示例#3
0
        public int tb_computerAdd(tb_computer compay)
        {
            int intResult = 0;

            try
            {
                getConnection getCon = new getConnection();
                oledCon = getCon.OledCon();
                oledCon.Open();
                string strAdd = "insert into tb_computer values( ";
                strAdd   += "'" + compay.cmp_ID + "','" + compay.cmp_name + "','" + compay.cmp_Paww + "','" + compay.cmp_DataTime + "',";
                strAdd   += "'" + compay.cmp_Falg + "')";
                oledcmd   = new SqlCommand(strAdd, oledCon);
                intResult = oledcmd.ExecuteNonQuery();
                return(intResult);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString());
                return(intResult);
            }
        }