控件中国网现已改版,您看到的是老版本网站的镜像,系统正在为您跳转到新网站首页,请稍候.......
中国最专业的商业控件资讯网产品咨询电话:023-67870900 023-67871946
产品咨询EMAIL:SALES@COMPONENTCN.COM

从SmartObject中读取数据

作者:佚名 出处:互联网 2011年08月01日 阅读:

从SmartObject中读取数据

       //根据KEY ID从SmartObject中取数据
        private void LoadData(string argProInstanceID)
        {
            SourceCode.SmartObjects.Client.SmartObjectClientServer socs = new SourceCode.SmartObjects.Client.SmartObjectClientServer();
           
            // build a connection string
            SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder connectionString = new SourceCode.Hosting.Client.BaseAPI.SCConnectionStringBuilder();
            connectionString.Authenticate = true;
            connectionString.Host = System.Configuration.ConfigurationManager.AppSettings["K2Server"];
            connectionString.Integrated = true;
            connectionString.IsPrimaryLogin = true;
            connectionString.Port = Convert.ToUInt32(System.Configuration.ConfigurationManager.AppSettings["HostServicePort"]);
            //connectionString.UserID = ";k2admin";
            //connectionString.Password = "******";
            connectionString.WindowsDomain = "dahanis";
            connectionString.SecurityLabelName = "K2";

            // open a K2 Server connection
            socs.CreateConnection();
            socs.Connection.Open(connectionString.ToString());
            try
            {
                // get a handle to the 'SODHFKSQ' SmartObject
                SourceCode.SmartObjects.Client.SmartObject so = socs.GetSmartObject("so_DHFKSQ");

                // specify which method will be called
                so.MethodToExecute = "Load";

                // specify input parameters for the method
                so.Properties["ProInstanceID"].Value = argProInstanceID;

                // call the method
                socs.ExecuteScalar(so);

                // note: if a method of type 'list' was specified, then the 'ExecuteList' method should be called
                // serverName.ExecuteList(smartObject);

                // read the return properties of the SmartObject
                Folio.Text = so.Properties["Folio"].Value;
                ApplyEmployee.Text = so.Properties["ApplyEmployee"].Value;
                ApplyAmount.Text = so.Properties["ApplyAmount"].Value;
                ApplyDate.Text = so.Properties["ApplyDate"].Value;
                HigherLevelApprover.Text = so.Properties["HigherLevelApprover"].Value;
                FinanceApprover.Text = so.Properties["FinanceApprover"].Value;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                // close the connection
                socs.Connection.Close();
            }
        }

 

热推产品

  • ActiveReport... 强大的.NET报表设计、浏览、打印、转换控件,可以同时用于WindowsForms谀坔攀戀Forms平台下......
  • AnyChart AnyChart使你可以创建出绚丽的交互式的Flash和HTML5的图表和仪表控件。可以用于仪表盘的创......
首页 | 新闻中心 | 产品中心 | 技术文档 | 友情连接 | 关于磐岩 | 技术支持中心 | 联系我们 | 帮助中心 Copyright-2006 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 电话:023 - 67870900 传真:023 - 67870270 产品咨询:sales@componentcn.com 渝ICP备12000264号 法律顾问:元炳律师事务所 重庆市江北区塔坪36号维丰创意绿苑A座28-5 邮编:400020
在线客服
在线客服系统
在线客服
在线客服系统