How do we convert a data from database into XMLfile using asp.net with vb.net
-
You can use DataSet[^] to load your database and after that you can call DataSet.WriteXml[^] method.
vbmadhavi wrote:
plzz send code also.
Writing your code is your responsibility. Just search for
DataSet
tutorials, you will find lots of information. :) I hope this helps. :) -
You can use DataSet[^] to load your database and after that you can call DataSet.WriteXml[^] method.
vbmadhavi wrote:
plzz send code also.
Writing your code is your responsibility. Just search for
DataSet
tutorials, you will find lots of information. :) I hope this helps. :)use Query From database Which gives to XML String. For Example: Select * from emp "Emplyee" FOR XML Auto Which gives out put like <Emplyee empid="11" ename="rajan" sal="1.200000000000000e+004" ephone="5654645" eAddress="baneshwor" /> <Emplyee empid="12" ename="pravakar" sal="2.500000000000000e+004" ephone="5654645" eAddress="shantinangar" /> <Emplyee empid="13" ename="nilu" sal="2.500000000000000e+004" ephone="5654645" eAddress="ghattekkulo" /> <Emplyee empid="14" ename="shekhar" sal="2.500000000000000e+004" ephone="5654645" eAddress="ekantakuna" /> <Emplyee empid="15" ename="sunil" sal="2.500000000000000e+004" ephone="5654645" eAddress="budanilakantha" /> <Emplyee empid="16" ename="Nilubhai" sal="2.000000000000000e+003" ephone="123456" eAddress="Kathmandu" />
-
use Query From database Which gives to XML String. For Example: Select * from emp "Emplyee" FOR XML Auto Which gives out put like <Emplyee empid="11" ename="rajan" sal="1.200000000000000e+004" ephone="5654645" eAddress="baneshwor" /> <Emplyee empid="12" ename="pravakar" sal="2.500000000000000e+004" ephone="5654645" eAddress="shantinangar" /> <Emplyee empid="13" ename="nilu" sal="2.500000000000000e+004" ephone="5654645" eAddress="ghattekkulo" /> <Emplyee empid="14" ename="shekhar" sal="2.500000000000000e+004" ephone="5654645" eAddress="ekantakuna" /> <Emplyee empid="15" ename="sunil" sal="2.500000000000000e+004" ephone="5654645" eAddress="budanilakantha" /> <Emplyee empid="16" ename="Nilubhai" sal="2.000000000000000e+003" ephone="123456" eAddress="Kathmandu" />
You probably have to post this message to OP, too. Your suggestion is good in case we want to save only data as XML. But if we want to save entire database, including schema information except data, then
DataSet.WriteXml
method is very handy. :) Regards