2015-02-10 45 views
1

我有以下數據集不能找到表0

private DataSet passwordManagement(int reseller_ID, string username, string password, int processType, DateTime? PasswordResetDate, bool? IsPasswordReset, string newPassword) 
     { 
      DataSet passwordManagement = new DataSet(); 


      SqlParameter[] PasswordManagementStoredProceduredParamaters = new SqlParameter[8]; 
      PasswordManagementStoredProceduredParamaters = SqlHelperParameterCache.GetSpParameterSet(uf.SecretPass(strConn), "PasswordManagement"); 

      dbconn.Open(); 

      PasswordManagementStoredProceduredParamaters[0].Value = reseller_ID; 
      PasswordManagementStoredProceduredParamaters[1].Value = username; 
      PasswordManagementStoredProceduredParamaters[2].Value = password; 
      PasswordManagementStoredProceduredParamaters[3].Value = processType; 
      PasswordManagementStoredProceduredParamaters[4].Value = PasswordResetDate; 
      PasswordManagementStoredProceduredParamaters[5].Value = DateTime.Today.AddYears(3); 
      PasswordManagementStoredProceduredParamaters[6].Value = IsPasswordReset; 
      PasswordManagementStoredProceduredParamaters[7].Value = newPassword; 


      passwordManagement = SqlHelper.ExecuteDataset(dbconn, CommandType.StoredProcedure, "PasswordManagement", PasswordManagementStoredProceduredParamaters); 
      passwordManagement.Tables[0].TableName = "passwordManagement"; 

      dbconn.Close(); 

      return passwordManagement; 
     } 

我嘗試返回數據集的方法,但是我得到的異常以下

無法找到表0

什麼添加到代碼的一面呢?

+0

請幫忙 – Soner 2015-02-10 14:18:04

回答

0

檢查您嘗試之前訪問dataset -

if(passwordManagement.Tables.Count > 0) 
    passwordManagement.Tables[0].TableName = "passwordManagement"; 

也檢查你procedure將返回與傳遞的參數行。