fiogf49gjkf0d Easy enough to dump XML from SLX data using .NET. Just fill a DataSet and save the underlying XML out to a file. Something like this:
public void ExportXml(string sql, string file) { OleDbConnection conn = new OleDbConnection(_slxconnstr); try { conn.Open(); DataSet ds = new DataSet(); OleDbDataAdapter da = new OleDbDataAdapter(sql, conn); da.Fill(ds); da.Dispose(); ds.WriteXml(file); } catch (Exception exp) { MessageBox.Show(exp.Message, exp.GetType().ToString()); } finally { conn.Close(); } } ' and to use... ExportXml("select * from account", @"C:\MyAccounts.xml"); Something as easy and generic as that will take any SQL statement and export it to an XML file. If you're on v7 this would make a real quick and dirty .NET extension and could make this a very easy task.
If you wanted to write this from within a VBScript, you can use the MSXML classes which will already exist on each machine where SLX is installed. See more here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/7e831db8-9d0a-43ff-87e9-11382721eb99.asp
You can also do this easily using ADO, although without as much control over the XML. The Recordset object has a built in way to cache or persist a Recordset as XML. Gather the data in a Recordset, then call the Recordset's Save method specifying XML as the persist format:
Sub ExportXml(ByVal Query, ByVal FileName) Dim rs Set rs = Application.GetNewConnection.Execute(Query) rs.Save FileName, adPersistXML ' <- adPersistXML has a value of 1 in case the enum isn't recognized in SLX VBScript rs.Close Set rs = Nothing End Sub ' to use ExportXml "select * from account", "C:\MyAccounts.xml"
Make sense? |