DataSet和DataReader中把读的数据放到string变量中,用逗号分隔。

1、DataSet中

dsRec = dboperReq.GetDSet(strSql) ;
      string strTypeSN = "" ;
     foreach( DataRow dr in dsRec.Tables[0].Rows)
     {
      strTypeSN += dr["ptypesn"].ToString() + "," ;
     }

2、DataReader中
OleDbDataReader dr =dboperReq.GetDReader(strSQL);
    while(dr.Read())
    {
     strProductSn+=dr[0].ToString()+",";
    }
    strProductSn2=strProductSn.Substring(0,strProductSn.Length-1);

原文地址:https://www.cnblogs.com/jameshappy/p/1383622.html