如何解决"索引超出了数组界限"?
索引超出了数组界限。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.IndexOutOfRangeException: 索引超出了数组界限。
源错误:
行 37: SqlParameter[] parms = new SqlParameter[]{
行 38: };
行 39: parms[0].Value = account.VipCode;
行 40: parms[1].Value = account.Zjcode;
行 41: parms[2].Value = account.Oldpassword;
源文件: g:\VIP\VIPWebsite\App_Code\DataProvider\EditPwdProvider.cs 行: 39
堆栈跟踪:
[IndexOutOfRangeException: 索引超出了数组界限。]
VIPWebsite.DataProvider.EditPwdProvider.Update(BaseEntity entity) in g:\VIP\VIPWebsite\App_Code\DataProvider\EditPwdProvider.cs:39
VIPWebsite.BussinesLogic.EditPwdManager.UserinfoUpdate(EditpwdEntity account) in g:\VIP\VIPWebsite\App_Code\BussinesLogic\EditPwdManager.cs:38
VIPWebsite.EditPassWord.Updateuserinfo() in g:\VIP\VIPWebsite\EditPassWord.aspx.cs:66
VIPWebsite.EditPassWord.SureButton_Click(Object sender, EventArgs e) in g:\VIP\VIPWebsite\EditPassWord.aspx.cs:99
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
---------------------------------------
EditPwdProvider.cs 代码如下:
using System;
using System.Data;
using System.Data.SqlClient;
using VIPWebsite.Entity;
namespace VIPWebsite.DataProvider
{
/// <summary>
/// Summary description for WebAccountProvider.
/// </summary>
public class EditPwdProvider : BaseDataProvider
{
private const string SQL_USER_update = "Update_userinfo ";
private const string PARM_vip_CODE = "@vipcode ";