TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Basit Khan
NA
336
121.2k
Data Export into XML Format in ASP.Net
Dec 20 2015 6:18 AM
Dear,
I export Data from ASP.Net/SQL to xml successfully.
Below is the code
Dim ds As New DataSet()
Try
Dim con As New SqlConnection("server=BAK;initial catalog=Test;uid=sa;pwd=sa")
con.Open()
Dim da As New SqlDataAdapter("select Emp_No,Emp_Name,Emp_GSM1 from Employee", con)
da.Fill(ds, "Employee")
Catch
'Label1.Text = "Error while connecting to a database"
End Try
Dim doc As New XmlDataDocument(ds)
Xml1.Document = doc
doc.Save("D:\Employee.xml")
But what i'm facing the problem, when Emp_GSM1 is null value then its not showing in XML file.
Example
<?xml version="1.0"?>
-<NewDataSet>
<Employee>
<Emp_No>1</Emp_No>
<Emp_Name>A</Emp_Name>
<Emp_GSM1>122</Emp_GSM1>
</Employee>
<Employee>
<Emp_No>2</Emp_No>
<Emp_Name>B</Emp_Name> ''here not exporting becoz Emp_GSM1
</Employee>
</NewDataSet>
How to export xml with even null value.
Thanks
Basit.
Reply
Answers (
2
)
posting data from view model to form (javascript)
Is there a deep insert support in HttpClient WebAPI in batch