开发者

Working with DataTables

These are two records which exist in a table:

ibrahim_balouch
ibrahim.tasal

I want to send an email to ibrahim.tasal. Here is my code开发者_开发问答:

string user2 = dt1.Rows[1].ItemArray[0].ToString();
mail.Cc = dt1.Rows[1].ItemArray[0].ToString() + "@Roshan.af";

Is this correct?


If you need to get the particular column value of the first row of the datatable then something like this will help you

string user2 = dt.Rows[1].Columns["EmailColumn"].ToString();
mail.Cc = user2 + "@Roshan.af";

If you don't know the column name then you can specify the column index also which starts from 0.


EDIT: The subject, which was to the effect of 'Hi, look at this code', has been changed. Nevermind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜