欢迎来到天天文库
浏览记录
ID:47283485
大小:54.59 KB
页数:5页
时间:2019-08-23
《存储过程动态配置3》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、usingSystem;usingSystem.Xml;usingSystem.Xml.Serialization;usingSystem.Xml.XPath;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Reflection;namespaceDhzShop.Config{//////Procedure的摘要说明。///publicclassProcedure{publicProcedure(){////TODO:
2、在此处添加构造函数逻辑//}privateCommand[]_Commands;[XmlArray(MCommandsM)]publicCommand[]Commands{get{returnthis._Commands;}set{this._Commands=value;}}publicstaticobjectlnstance(System.Web-HttpContextcontext){System.Xml.XmlDocumentdoc=newSystem.Xml.XmlDocument();doc.Load(co
3、ntext-Server.MapPath(,'Config/Procedure.xmr,));System.Xml.XmlNodeListnodeList=doc.GetElementsByTagName(”Procedure");if(nodeList.Count!=1)thrownewException("配置参数岀错了!!");System.Xml.XmlNodesection=nodeList.ltem(0);XPathNavigatornav=section.CreateNavigator();stringt
4、ypename=(string)nav.Evaluate(ffstring(@type)ff);Typet=Type.GetType(typename);XmlSerializerser=newXmlSerializer(t);XmlNodeReaderxnr=newXmlNodeReader(section);objectobj=ser.Deserialize(xnr);returnobj;}publicstaticvoidExecCmdNonQuery(System.Web.HttpContextcontext,s
5、tringcmdname,objectarg){SqlCommandsqlcmd=null;Config.Procedureprocfg=Config.Procedure.Instance(context)asConfig.Procedure;intks=procfg.Commands.Length;inti=0;for(i=0;i6、ommands[i].toSqlCommand();break;}电影在线观看www.yiyil1.netusing(SqlConnectioncnn=Config.SqlConfig.GetSqlConn())sqlcmd.Connection=cnn;Commandcmd=procfg・Commands[i];boolpout=false;if(System.Type.GetType(cmd.ArgType)==arg.GetType()){ks=cmd.Parameters.Length;for(i=0;i7、;i++){if(cmd.Parameters[i].Direction!=System.Data.ParameterDirection.Input){pout=true;}if(cmd.Parameters[i].Direction==System.Data.ParameterDirection.ReturnValue8、9、cmd.Parameters[i].Direction==System.Data.ParameterDirection.Output)sqlcmd.Parameters[cmd.Parameters10、[i].ParameterName].Value=Config.Procedure.GetObjectPropertyValue(arg,cmd.Parameters[i].MapFid);erm.Open();sqlcmd.ExecuteNonQuery();cnn.Close();if(pout)for(i=0;i
6、ommands[i].toSqlCommand();break;}电影在线观看www.yiyil1.netusing(SqlConnectioncnn=Config.SqlConfig.GetSqlConn())sqlcmd.Connection=cnn;Commandcmd=procfg・Commands[i];boolpout=false;if(System.Type.GetType(cmd.ArgType)==arg.GetType()){ks=cmd.Parameters.Length;for(i=0;i7、;i++){if(cmd.Parameters[i].Direction!=System.Data.ParameterDirection.Input){pout=true;}if(cmd.Parameters[i].Direction==System.Data.ParameterDirection.ReturnValue8、9、cmd.Parameters[i].Direction==System.Data.ParameterDirection.Output)sqlcmd.Parameters[cmd.Parameters10、[i].ParameterName].Value=Config.Procedure.GetObjectPropertyValue(arg,cmd.Parameters[i].MapFid);erm.Open();sqlcmd.ExecuteNonQuery();cnn.Close();if(pout)for(i=0;i
7、;i++){if(cmd.Parameters[i].Direction!=System.Data.ParameterDirection.Input){pout=true;}if(cmd.Parameters[i].Direction==System.Data.ParameterDirection.ReturnValue
8、
9、cmd.Parameters[i].Direction==System.Data.ParameterDirection.Output)sqlcmd.Parameters[cmd.Parameters
10、[i].ParameterName].Value=Config.Procedure.GetObjectPropertyValue(arg,cmd.Parameters[i].MapFid);erm.Open();sqlcmd.ExecuteNonQuery();cnn.Close();if(pout)for(i=0;i
此文档下载收益归作者所有