Location of file written by WriteXML

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am using the following code in an attempt to write my dataset to XML.

Function GetRecordCount() as integer

Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB
Services=-4; Data Source=c:\path\fmdb.mdb"
Dim queryString As String = "SELECT [rfi].* FROM [rfi]"
Dim RcdCount As String

Dim m_XmlFile As String = "myrfi.xml"
Dim m_SchemaFile As String = "myrfi.xsd"

Dim dataAdapter As New OleDbDataAdapter(querystring, strConnString)
Dim dataSet As DataSet = New DataSet()

dataAdapter.Fill(dataSet, "rfi")

dataSet.WriteXmlSchema(m_SchemaFile)
dataSet.WriteXml(m_XmlFile, XmlWriteMode.IgnoreSchema)

RcdCount = dataSet.Tables("rfi").Rows.Count.ToString()
return RcdCount

End Function

The function is called and no errors occur but I cannot find my
new XML file myrfi.xml anywhere on the root directory of my webserver.

Not sure if I even need the call to WriteXmlSchema or not...

What am I missing here?

Thanks in advance for any tips.

- Glenn
 
WriteXmlSchema writes out the DataSet definition. WriteXml writes out the
actual data.

To write out to a web directory, you should MapPath to get root and then add
that part of the path to your document name. I am not completely sure where
it would save the document if you simply call write with a file name only.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
 
Gregory,

That did the trick. Sorry for the simple question. Guess I was just having
a senior moment.

- Glenn

Cowboy (Gregory A. Beamer) said:
WriteXmlSchema writes out the DataSet definition. WriteXml writes out the
actual data.

To write out to a web directory, you should MapPath to get root and then add
that part of the path to your document name. I am not completely sure where
it would save the document if you simply call write with a file name only.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
glenn said:
Hello,

I am using the following code in an attempt to write my dataset to XML.

Function GetRecordCount() as integer

Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB
Services=-4; Data Source=c:\path\fmdb.mdb"
Dim queryString As String = "SELECT [rfi].* FROM [rfi]"
Dim RcdCount As String

Dim m_XmlFile As String = "myrfi.xml"
Dim m_SchemaFile As String = "myrfi.xsd"

Dim dataAdapter As New OleDbDataAdapter(querystring, strConnString)
Dim dataSet As DataSet = New DataSet()

dataAdapter.Fill(dataSet, "rfi")

dataSet.WriteXmlSchema(m_SchemaFile)
dataSet.WriteXml(m_XmlFile, XmlWriteMode.IgnoreSchema)

RcdCount = dataSet.Tables("rfi").Rows.Count.ToString()
return RcdCount

End Function

The function is called and no errors occur but I cannot find my
new XML file myrfi.xml anywhere on the root directory of my webserver.

Not sure if I even need the call to WriteXmlSchema or not...

What am I missing here?

Thanks in advance for any tips.

- Glenn
 
Back
Top