>int ICounter; >for (ICounter = 1; ICounter <= 4; ICounter++) >{ > string paramString = "param" + ICounter.ToString(); >} >You can do something like this:
StringBuilder SB = new StringBuilder(); // This is your select string...initialize it as needed string ParamString; IDbDataParameter[] Params = new IDbDataParameter[4]; // This is hard-coded to 4, but you can use a variable instead mmDataAccessBase DAO = this.GetDataAccessObject(); for (int ICounter = 0; ICounter <= 4; ICounter++) { ParamString = DAO.ParameterPrefixChar + "Param" + ICounter.ToString(); // This is the key to creating parameters to be passed...replace the 0 with the real value Params[ICounter] = this.CreateParameter(ParamString, 0); // NOTE: Add code here to concatenate the parameters to your SELECT statement in the StringBuilder } // Note that an IDbDataParameters array is passed rather than passing individual parameters...another key to solving this problem this.GetDataSet(SB.ToString(), Params);