原文第4行为:
TheMailMessage.To = DSPageData.Tables["Emails"].Rows[I].Item["CustomerEmail"];

解决方案 »

  1.   

    what is "I"??SqlComm = new SqlDataAdapter("Select Distinct CustomerEmail from Customers Where GroupName = '" + ddlGroupName.SelectedItem.Text + "' ", SqlConn);
    SqlComm.Fill(DSPageData,"Emails");
    if (DSPageData.Tables["Emails"].Rows.Count > 0)
       TheMailMessage.To = DSPageData.Tables["Emails"].Rows[0]["CustomerEmail"];
      

  2.   

    for(I = 0 ; I <= DSPageData.Tables["Emails"].Rows.Count - 1 ; I++)
    下面一行的正确写法,哪位大哥能教教我:
    TheMailMessage.To = DSPageData.Tables["Emails"].Rows[I].Item["CustomerEmail"];

    TheMailMessage.To = DSPageData.Tables["Emails"].Rows[0].Item["CustomerEmail"];
    目的是从dataset里面的Emails表中取出第I行“CustomerEmail”列的数据赋值给TheMailMessage.To。
      

  3.   

    foreach(DataRow row in DSPageData.Tables["Emails"].Rows)
    {
      TheMailMessage.To = row["CustomerEmail"].ToString;
    }
      

  4.   

    for(I = 0 ; I <= DSPageData.Tables["Emails"].Rows.Count - 1 ; I++)
    {
    TheMailMessage.To=DSPageData.Tables["Emails"].Rows[I]["CustomerEmail"].ToString();
    }