日期:2014-05-20  浏览次数:20438 次

c#如何实现这样的代码
dim     voteds   as   dataset   =new   dataset()
      voteds.ReadXml(Server.MapPath( "db\vote.xml "))
voteds.tables(0).rows(0).item(0)+=1

select   case   radio1.selecteditem.value
case   "1 "
            voteds.tables(0).rows(0).item(1)+=1
case   "2 "
    voteds.tables(0).rows(0).item(2)+=1
case   "3 "
    voteds.tables(0).rows(0).item(3)+=1
case   "4 "
    voteds.tables(0).rows(0).item(4)+=1
end   select  
voteds.writexml((Server.MapPath( "db\vote.xml ")))
用C#做如何完成呢?

------解决方案--------------------
DataSet voteds=new DataSet();
voted.ReadXml((Server.MapPath( "db\vote.xml "));
DataTable dt=voted.Tables[0];
dt.Rows[0][Convert.ToInt32(radio1.SelectedItem.Value)]=Convert.ToInt32(dt.Rows[0][Convert.ToInt32(radio1.SelectedItem.Value)])+1;
voteds.WriteXml((Server.MapPath( "db\vote.xml ")));