Abundant Technologies - IT Consulting Experts

 Source Code Library

 Code Details

'put this code on a form with a Datagrid and 2 Command Buttons 'The nwind.mdb database is required Option Explicit Private cn As ADODB.Connection Private rs As ADODB.Recordset Private Sub cmdConnect_Click() Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Program Files\DevStudio\VB\NWIND.MDB" cn.CursorLocation = adUseClient cn.Open rs.Open "select * from products", cn, adOpenStatic, adLockOptimistic Set DataGrid1.DataSource = rs End Sub Private Sub cmdXML_Click() Dim objDOC As DOMDocument Dim objNodeList As IXMLDOMNodeList Dim objIE As InternetExplorer Set objDOC = New DOMDocument objDOC.Load App.Path & "\nwindprod.xml" Set objNodeList = objDOC.documentElement.selectNodes("Product") With objNodeList(0) .childNodes(0).Text = rs.Fields("ProductID") .childNodes(1).Text = "" & rs.Fields("ProductName") .childNodes(2).Text = "" & rs.Fields("SupplierID") End With objDOC.save App.Path & "\nwindprod.xml" Set objIE = New InternetExplorer objIE.Navigate App.Path & "\nwindprod.xml" objIE.Visible = True End Sub Private Sub Form_Unload(Cancel As Integer) On Error Resume Next rs.Close cn.Close Set rs = Nothing Set cn = Nothing End Sub

Mail To: info@3pc.com