开发者

Converting datarow[] to xml. Is it possible?

开发者 https://www.devze.com 2023-01-04 06:00 出处:网络
I have one application, in that i am using a datarow object like this. DataRow[] drRow; drRow = _dsmenu.Tables[\"tblmenu\"].Select(\"id=\'\" + DocID + \"\'\");

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

精彩评论

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