Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / May 2005

Tip: Looking for answers? Try searching our database.

SQL to well formatted XML file via .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Benjatado - 18 May 2005 18:11 GMT
I am trying to create several .xml files, mirrored from my SQL database that
are shaped according to an XSD schema. However, I have hit a brick wall!
Droving through several materials on how to perform this function has
resulted in some slightly jarring results!
Basically, I would like to create a dataset.xsd XML map of a stored
procedure from the SQL database, and through use of this .xsd pass the
resulting correctly formatted .xml to a file (or heck even the /bin!)
Here is a code that I have been working with to take the stored procedure
view and pass it to an .xml file - to the /bin. But the dataset.xsd file does
not effect the result, nor return the correct schema using "WriteSchema".
I must be missing something crucial...

CODE
CODE:
Imports System
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Xml

Module Module 1
   
   Sub Main()
Dim objConn As New SqlConnection("Server=...;Database=....;Integrated
Security=....")
objConn. Open()
Dim objCmd As New SqlCommand("MyProcedure", objConn)
objCmd.CommandType = CommandType.StoredProcedure
Dim objAdpt As New SqlDataAadapter (objCmd)
Dim objDs As New DataSet ("MyDataset")
objAdpt.Fill (objDs, "Catalog")
Dim objFile As New FileStream("Catalog.xml", FileMode.Create)
Dim objSWriter As New StreamWriter(objFile)
objDs.WriteXml(objSWriter.XmlWriteMode.WriteSchema)
objSWriter.Close()
objFile.Close()
objConn.Close()

End Sub
End Module

I hope someone can point me in the right direction here...
Thanks -
Benjatado
Clamps - 18 May 2005 22:21 GMT
> I am trying to create several .xml files, mirrored from my SQL database that
> are shaped according to an XSD schema. However, I have hit a brick wall!
[quoted text clipped - 40 lines]
> Thanks -
> Benjatado
Why not just use objDs.writexmlschema?
Benjatado - 23 May 2005 01:31 GMT
> Why not just use objDs.writexmlschema?

Would that write the XML document based upon the XSD with the
sql:relationship tags? Or would it write out the schema only?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.