StringBuffer sql = new StringBuffer();或(StringBuilder sql = new StringBuilder ())
sql.Append("select * from);
sql.Append("数据库名");
sql.Append("where 条件");
sqlcommand dt = new sqlcommand();
sqlDataAdapter dt = new sqlDataAdapter ();
dt.Selectcommand = sql ;
DataSet ds = new DataSet ();
ds.Fill(dt);
if(ds.rows.count>1)
{
条件
}