利用soap来给字符串数组赋值函数

来源:互联网 发布:下载语音朗读软件 编辑:程序博客网 时间:2024/05/23 01:36
 

        public bool SetAppdata(string globadataname, string[] value)
        {
            try
            {

           //1.传入参数检查
            if (value == null || value.Length <= 0)
            {
                return false;
            }

 

           //2. 状态检查

                    if (m_cs8ServerV1 == null || m_sessionId <= 0)
                    {
                        return false;
                    }

           //3.变量定义

                int count = value.Length;
                string libname = SoapLibname;
                string m_applicationName = SoapSetAppname;
                string strOut = null;
                execVal3ReturnCode res;

 

         //4.循环赋值
                    while (count > 0)
                    {
                        string cmd = libname + ":" + globadataname + "[" + (count - 1).ToString() + "]"
                                     + "=" + "\"" + value[count - 1] + "\"";
                        res = m_cs8ServerV2.execVal3(m_sessionId, m_applicationName, "", "", 0, cmd, out strOut);
                        if (strOut != string.Empty || res.ToString() != "EXVNOERROR")
                        {

                            return false;
                        }
                        count--;
                    }

                    return true;

                }

        //5. 补捉异常
                catch
                {
                    return false;
                }
        }

原创粉丝点击