2012年6月21日 星期四

List 與 string.Join 用法

List tfs6code = new List(); foreach (KeyValuePair item in dFs6CodeList) { tfs6code.Add(item.Key); } //取得資料 sSQL = string.Format(@" select * from fss6add where fs6ordc = '{0}' ", txtfs6ordc.Text.Trim() ); sSQL = string.Format(sSQL + @" and fs6code in ({0}) order by fs6code ", "'" + string.Join("','", tfs6code.ToArray()) + "'"); DataSet ds = oDALcmch002_mgt.ExcuteToDataset(sSQL);