个SQLParameterCollection已包含SqlPar

个SQLParameterCollection已包含SqlPar

本文介绍了错误:另一个SQLParameterCollection已包含SqlParameter.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void UpdateUserStatus(string CollectionUserId, string CollectionStatus, int CountDisabled, int CountEnalbed, int companyId)
        {
            try
            {
                string[] individualStatus = CollectionStatus.Split(',');
                string[] individualUserid = CollectionUserId.Split(',');
                  for (int i = 0; i < individualStatus.Length; i++)
                  {
                    DbParams dbParams = new DbParams();
                    dbParams.Add<int>("UserID", Convert.ToInt32(individualUserid[i]));
                    dbParams.Add<int>("Status",Convert.ToInt32(individualStatus[i]));
                    DataContext.ExecuteProc(DbNames.UPDATE_USERSTATUS, dbParams);




                if (CountEnalbed != 0 || CountDisabled != 0)
                {
                    dbParams.Add<int>("UserID",Convert.ToInt32(individualUserid[i]));
                    dbParams.Add<int>("Status",Convert.ToInt32(individualStatus[i]));
                    dbParams.Add<int>("CompanyID",CompanyID);
                    DataContext.ExecuteProc(DbNames.INSERT_MEMBER_TRANSACTION, dbParams); // Error : The SqlParameter is already contained by another SqlParameterCollection.

                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

帮我.这是我第一次看到它的期望,我对goion在...上的困惑感到困惑.

help me.here is expection i saw it first time and i m confused whts goion on...

Error : The SqlParameter is already contained by another SqlParameterCollection.

推荐答案


这篇关于错误:另一个SQLParameterCollection已包含SqlParameter.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 22:44