• 动态增加SqlParameter[]中的元素,自己的记录


                    sqlsp = "BlogArticle_Update";
                    SqlParameter[] param 
    = {
                                            
    new SqlParameter("Content",Content.Value),
                                        };
                    
    //重构数组
                    SqlParameter[] param2;
                    
    if (IsDefineWeight == "1")
                    {
                        
    int newNum = param.Length + 1;
                        param2 
    = (SqlParameter[])Redim(param, newNum);
                        param2[newNum 
    - 1= new SqlParameter("Weight", weight.Text);
                    }
                    
    else
                    {
                        param2 
    = param;
                    }

                    DAL.dbsp.ExecuteNonQuery(sqlsp, param2);

    自己的记录

            public static Array Redim(Array origArray, Int32 desiredsize)
            {
                
    //确定每个元素类 型    
                Type t = origArray.GetType().GetElementType();
                
    //创建一个含有期望元素个数的新数组  
                
    //新数组的类型必须匹配原数组的类型  
                Array newArray = Array.CreateInstance(t, desiredsize);
                
    //将原数组中的元素拷贝到新数组中  
                Array.Copy(origArray, 0, newArray, 0, Math.Min(origArray.Length, desiredsize));
                
    return newArray;
            }
  • 相关阅读:
    Spark高可用集群搭建
    Promise
    Redux 检测状态树变更
    React forwardRef:跳转引用
    React createRef:引用
    Git 分支合并:合并某次提交
    Eclipse 创建Android 模拟器失败:no cpu/abi system image available for this target
    Eclipse Android 模拟器启动过慢
    Mac Eclipse 配置 SDK Manager Proxy (代理)
    Mac 安装、卸载JDK 1.6
  • 原文地址:https://www.cnblogs.com/yeagen/p/1428871.html
Copyright © 2020-2023  润新知