Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
private void WriteXmlToFile(DataSet thisDataSet) {
if (thisDataSet == null) { return; }
// Create a file name to write to.
string filename = "myXmlDoc.xml";
// Create the FileStream to write with.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename, System.IO.FileMode.Create);
// Create an XmlTextWriter with the fileStream.
System.Xml.XmlTextWriter myXmlWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write to the file with the WriteXml method.
thisDataSet.WriteXml(myXmlWriter);
myXmlWriter.Close();
}
Imports System.Xml
Imports System.Xml.Xsl
[highlight]Public variable in your class [/Highlight]
Public appPath As String = context.Request.ApplicationPath
Public strFile As String = appPath & "/XMLFolder\MyTable.xml"
[highlight]put this code in page load[/highlight]
if If Not IsPostBack Then
Dim myConnection As SqlConnection = New SqlConnection("MySQLServer")
Dim Myds as DataSet = new DataSet()
dim sSql as string = "SELECT * FROM MyTable"
'Declare an Adapter and Fill Dataset
dim adapter as SqlDataAdapter = new SqlDataAdapter(sSql, myConnection)
adapter.Fill(Myds)
myConnection.Close()
Myds.WriteXml(StrFile, XmlWriteMode.IgnoreSchema)
End if