Esempio n. 1
0
 public static DataTable GetTempletInfoByTemplet_ID(int templet_ID)
 {
     try
     {
         DataTable           DT_Temp             = new DataTable();
         MySqlConnectionHelp mySqlConnectionHelp = new MySqlConnectionHelp();
         MySqlConnection     mySqlConnection     = mySqlConnectionHelp.GetMySqlCon();
         string       sql          = "select * from sp_templet_info where Templet_ID = " + templet_ID;
         MySqlCommand mySqlCommand = new MySqlCommand(sql, mySqlConnection);
         DT_Temp = mySqlConnectionHelp.GetDataSet(mySqlCommand).Tables[0];
         mySqlConnectionHelp.CloseConn(mySqlConnection);
         return(DT_Temp);
     }
     catch (Exception ex)
     {
         AlarmRecord("数据库", ex.Message);
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Esempio n. 2
0
        public static DataTable GetCommandInfo()
        {
            try
            {
                DataTable DT_Temp = new DataTable();

                MySqlConnectionHelp mySqlConnectionHelp = new MySqlConnectionHelp();
                MySqlConnection     mySqlConnection     = mySqlConnectionHelp.GetMySqlCon();
                string       sql          = "select * from tk_command";
                MySqlCommand mySqlCommand = new MySqlCommand(sql, mySqlConnection);
                DT_Temp = mySqlConnectionHelp.GetDataSet(mySqlCommand).Tables[0];
                mySqlConnectionHelp.CloseConn(mySqlConnection);
                return(DT_Temp);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(null);
            }
        }
Esempio n. 3
0
        public static DataTable GetPaintPathPositionByTemplet_ID(int templet_ID)
        {
            try
            {
                DataTable           DT_Temp             = new DataTable();
                MySqlConnectionHelp mySqlConnectionHelp = new MySqlConnectionHelp();
                MySqlConnection     mySqlConnection     = mySqlConnectionHelp.GetMySqlCon();
                //string sql = "select * from sp_paint_path_position_info where Templet_ID = " + templet_ID + " ORDER BY  Start_Position_X DESC";
                string sql = "select * from sp_paint_path_position_info where Templet_ID = " + templet_ID;

                MySqlCommand mySqlCommand = new MySqlCommand(sql, mySqlConnection);
                DT_Temp = mySqlConnectionHelp.GetDataSet(mySqlCommand).Tables[0];
                mySqlConnectionHelp.CloseConn(mySqlConnection);
                return(DT_Temp);
            }
            catch (Exception ex)
            {
                AlarmRecord("数据库", ex.Message);
                MessageBox.Show(ex.Message);
                return(null);
            }
        }
Esempio n. 4
0
        public static void AlarmRecord(string alarmType, string alarmInfo)
        {
            try
            {
                MySqlConnectionHelp mySqlConnectionHelp = new MySqlConnectionHelp();
                MySqlConnection     mySqlConnection     = mySqlConnectionHelp.GetMySqlCon();
                string sql;
                sql = "insert into sp_alarm_info(Alarm_Type,Alarm_Info,Alarm_Time,Alarm_Date)" +
                      " values( '" + alarmType + "' ,'" + alarmInfo + "' ,'" + DateTime.Now + "' ,'" + DateTime.Now.Date + "' )";

                MySqlCommand mySqlCommand     = new MySqlCommand(sql, mySqlConnection);
                int          returnCode_Mysql = mySqlCommand.ExecuteNonQuery();//3.执行插入、删除、更改语句。执行成功返回受影响的数据的
                mySqlConnectionHelp.CloseConn(mySqlConnection);
                if (returnCode_Mysql <= 0)
                {
                    MessageBox.Show("报警信息保存失败");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }