示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {

            List<string[]> result = new List<string[]>();
               // string sql = "select * from consume_items_supplier";
             //   mysql.MySqlRead(ref result);

               string sql = @"create table consume_records_image(
            RECORD_NO BIGINT AUTO_INCREMENT PRIMARY KEY NOT NULL,
            ITEM_NO      INTEGER(7)  NOT NULL COMMENT '货号',
            fileName     VARCHAR(1024) NOT NULL COMMENT '图像文件名',
            WORK_DATE    timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP         COMMENT '发货时间')ENGINE=InnoDB
            CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'
            COMMENT='发货图片记录'";

             sql=@"CREATE DATABASE `consume_db_temp`
            CHARACTER SET 'utf8'
            COLLATE 'utf8_general_ci'";
            MySqlSimpleOper mysql = new MySqlSimpleOper("127.0.0.1", "consume_db", "root", "123456", sql);

            string[] array=new string[1];
            array[0] = sql;
            mysql.MySqlExecuteNoQuery(array);
            /*
            //sql = "update consume_records set qty=4";
            //mysql.SqlString = sql;
            //mysql.OracleUpdate();

            string[] sqls = new string[4];
            sqls[0] = @"insert into consume_records (item_no,name,qty,shpe_name,work_date) values (123456,'123',1,'测试',now())";
            //sqls[0] = @"insert into consume_records (item_no,name,qty,shpe_name,work_date) values (123456,'123',1,'测试','2015-08-19')";
            //sqls[1] = @"insert into consume_records (item_no,name,qty,shpe_name,work_date) values (123456,'123',1,'测试','2015-08-21')";
            //sqls[2] = @"update consume_records set qty=5 where qty=1 and work_date='2015-08-19'";
            //sqls[3] = @"insert into consume_records (record_no,item_no,name,qty,shpe_name,work_date) values (1,123456,'123',1,'测试','2015-08-19')";
            mysql.MySqlExecuteNoQuery(sqls);

            sql = @"delete from consume_records where qty=2";
            mysql.MySqlDelete(sql);
             * */
            }
            catch (System.Exception ex)
            {
                if (ex.Message.IndexOf("exists", 0) != -1)
                {
                    MessageBox.Show("表已存在");

                }
            }
        }
 public override void OutPut(ref List<string[]> paramers)
 {
     //取得结果
     mySqlSimpleOper = new MySqlSimpleOper(db_name, user, pwd, GetSql());
     mySqlSimpleOper.MySqlRead(ref paramers);
 }
 public override void OutPut(ref List<string[]> parameters)
 {
     try
     {
         //取得结果
         string[] parameter_out = new string[1];
         mySqlSimpleOper = new MySqlSimpleOper(db_name, user, pwd);
         mySqlSimpleOper.MySqlInsert(GetSql(), ref parameter_out);
         for (int i = 0; i < parameter_out.Length; i++)
         {
             parameters[i][0] = parameter_out[i];
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("失败!" + ex.StackTrace + ex.Message);
         throw;
     }
 }
 public override void OutPut(ref List<string[]> parameters)
 {
     try
     {
         Sql_result_struct sql_struct = new Sql_result_struct2();
         string[] parameter_out = new string[sql_struct.GetParamCount()];
         for (int i = 0; i < parameter_out.Length; i++)
         {
             parameter_out[i] = parameters[i][0];
         }
         //取得结果
         mySqlSimpleOper = new MySqlSimpleOper(db_name, user, pwd);
         mySqlSimpleOper.MySqlExecuteNoQuery(GetSqls(), ref parameter_out);
         for (int i = 0; i < parameter_out.Length; i++)
         {
             parameters[i][0] = parameter_out[i];
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("失败!" + ex.StackTrace + ex.Message);
         throw;
     }
 }
 //库存
 public override void OutPut(ref  List<string[]> parameters)
 {
     //
     //Sql_result_struct sql_struct = new Sql_result_struct1();
     //parameters[0] = new string[sql_struct.GetParamCount()];
     //取得结果
     mySqlSimpleOper = new MySqlSimpleOper(db_name, user, pwd, GetSql());
     mySqlSimpleOper.MySqlRead(ref parameters);
 }
 public override void OutPut(ref List<string[]> parameters)
 {
     try
     {
         mySqlSimpleOper = new MySqlSimpleOper(db_name, user, pwd, GetSql());
         mySqlSimpleOper.MySqlRead(ref parameters);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("失败!" + ex.StackTrace + ex.Message);
         throw;
     }
 }