#regionThat tests the array type.string[] mobiles =New string[] {"18975887650","18775887650","18977487650","18975887512" }; /// <summary> ///loop to get multiple phone numbers separated by commas/// </summary> /// <returns></returns> Public stringGetmobile () {stringStrmobile =""; for(inti =0; I < mobiles. Length; i++) {Strmobile+ = Mobiles[i] +","; } if(Strmobile. Length >0) {Strmobile= Strmobile. Substring (0, Strmobile. Length-1); returnStrmobile; } returnStrmobile; } #endregion
The database gets:
#regionMultiple phone numbers/// <summary> ///Get the user phone number in the database get an array of multiple phone numbers separated by commas/// </summary> Public stringGetmobilenumber () {stringStrmobilenumbers =""; DataTable DT=Jub. Get_mobile (MU. Mobilenumber); //Read cell phone information data from the database//mobiles = dt. rows[0]["Mobilenumber"]. ToString (); //Defining Arrays string[] Mobilenumbers =New string[dt. Rows.Count]; if(dt. Rows.Count >0) { //Cyclic data for(inti =0; i < dt. Rows.Count; i++) {DataRow Dr=dt. Rows[i]; Mobilenumbers[i]= dr["Mobilenumber"]. ToString ();//assigning values to arraysStrmobilenumbers + = Mobilenumbers[i] +","; } if(Strmobilenumbers. Length >0) {strmobilenumbers= Strmobilenumbers. Substring (0, Strmobilenumbers. Length-1); returnstrmobilenumbers; } returnstrmobilenumbers; } returnstrmobilenumbers; } #endregion