开发者

Converting datarow[] to xml. Is it possible?

I have one application, in that i am using a datarow object like this.

DataRow[] drRow;
                drRow = _dsmenu.Tables["tblmenu"].Select("id='" + DocID + "'");

After this i make some changes in columns like this

drRow[0]["Allow"] = "Yes";

after all the changes, i need to save that particular datarow as a xml to the db. I can do the dataset to 开发者_如何学Pythonthe xml by getdataset() method. But i need to save only that particular datarow. Is it Possible? If yes please help me. thanks in advance..


I'm afraid this is not possible. I recommend you to do it this way.

    DataRow[] rows = _dsmenu.Tables["tblmenu"].Select("id='" + DocID + "'");
    rows[0]["Allow"] = "Yes";

    DataTable table = new DataTable();

    foreach (DataRow row in rows)
    {
        table.ImportRow(row);
    }

    table.WriteXml(""); // Take this into database.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜