我在一份档案中有我的手脚,我需要能够从我的剪切申请中执行。 下面是文字的样本:
USE osae;
-- Set DB version
CALL osae_sp_object_property_set( SYSTEM , DB Version , 0.3.5 , , );
CALL osae_sp_object_property_set( SYSTEM , Debug , FALSE , , );
CALL osae_sp_object_type_property_add ( Prune Logs , Boolean , TRUE , SYSTEM ,0);
CALL osae_sp_object_property_set ( SYSTEM , Prune Logs , TRUE , , );
DELIMITER $$
DROP PROCEDURE IF EXISTS osae_sp_object_event_script_update$$
CREATE DEFINER = root @ localhost
PROCEDURE osae_sp_object_event_script_update(IN pobject varchar(200), IN pevent varchar(200), IN ptext text)
BEGIN
DECLARE vObjectCount INT;
DECLARE vObjectID INT;
DECLARE vObjectTypeID INT;
DECLARE vEventCount INT;
DECLARE vEventID INT;
SELECT COUNT(object_id) INTO vObjectCount FROM osae_object WHERE UPPER(object_name)=UPPER(pobject);
IF vObjectCount > 0 THEN
SELECT object_id,object_type_id INTO vObjectID,vObjectTypeID FROM osae_object WHERE UPPER(object_name)=UPPER(pobject);
SELECT COUNT(event_id) INTO vEventCount FROM osae_object_type_event WHERE object_type_id=vObjectTypeID AND (UPPER(event_name)=UPPER(pevent) OR UPPER(event_label)=UPPER(pevent));
IF vEventCount = 1 THEN
SELECT event_id INTO vEventID FROM osae_object_type_event WHERE object_type_id=vObjectTypeID AND (UPPER(event_name)=UPPER(pevent) OR UPPER(event_label)=UPPER(pevent));
UPDATE osae_object_event_script SET event_script=ptext WHERE object_id=vObjectID AND event_id=vEventID;
-- CALL osae_sp_debug_log_add(CONCAT( Updated ,vObjectID, - ,vEventID,ptext), );
END IF;
END IF;
END
$$
DELIMITER ;
由于你可以看到,它有一条混合线,要求储存程序,有些下降,并编制更新其他储存程序的声明。
我尝试了两种不同的方法来执行文字,这两种方法都失败了:
MySqlScript script = new MySqlScript(connection, File.ReadAllText("script.sql"));
script.Execute();
这 exception倒了例外:指数超出了阵列的范围。
MySqlCommand upgCommand = new MySqlCommand();
upgCommand.Connection = connection;
upgCommand.CommandText = File.ReadAllText("script.sql");
upgCommand.ExecuteNonQuery();
这使我的一个例外是,我的yn子有错误。
当我手工操作整个录像带时,它完全执行。 我如何能够从我的C#附录中正确执行这一文字。