Menu

#1 Export to (Typed) Dataset

open
nobody
None
5
2004-08-19
2004-08-19
No

Thanks for a great product!

Any chance of getting an export to dataset function?
The examples
(http://atomnet.sourceforge.net/example.html) have a
nice one but how about expanding this. Also, adding an
xsd schema (i.e. creating a typed dataset) would be
even more useful.

In the interim I've created the following based on Russell
Lindell's, but it would be nicer if Atom.NET contained it:

Function GetDataset(ByRef myfeed As AtomFeed) As
DataSet
Dim dsBlog As New DataSet

dsBlog.Tables.Add("tblEntries")
dsBlog.Tables("tblEntries").Columns.Add("Title",
GetType(String))
dsBlog.Tables("tblEntries").Columns.Add("URL",
GetType(String))
dsBlog.Tables("tblEntries").Columns.Add
("EntryDate", GetType(Date))
dsBlog.Tables("tblEntries").Columns.Add("Author",
GetType(String))
dsBlog.Tables("tblEntries").Columns.Add("Content",
GetType(String))

dsBlog.ExtendedProperties.Add("LatestBlogDate",
myfeed.Entries.Item(0).Issued.DateTime)

For Each oEntry As AtomEntry In myfeed.Entries
Dim oRow As DataRow = dsBlog.Tables
("tblEntries").NewRow
oRow!Title = oEntry.Title.Content
oRow!URL = oEntry.Links.Item(1).HRef.ToString
oRow!EntryDate = oEntry.Issued.DateTime
oRow!Author = oEntry.Author.Name()
oRow!Content = oEntry.Contents.Item
(0).Content
dsBlog.Tables("tblEntries").Rows.Add(oRow)
Next

Return dsBlog
End Function

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.