//此处是利用SQL的两项筛选作为例子
List<string> selectList=new List<string>(); //定义LIST
string sql="";
//判断区
if (inde.Checked)
selectList.Add(inde.Text);
if (name.Checked)
selectList.Add(name.Text);
//筛选区
string st = "";
foreach (string s in selectList)
{
st += s +",";
}
char[] charsToTrim = { ','}; //修整方法
sql = "select " + st.TrimEnd(charsToTrim) + " from table1 ";