PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Location of file written by WriteXML

Reply

Location of file written by WriteXML

 
Thread Tools Rate Thread
Old 15-09-2006, 04:15 PM   #1
=?Utf-8?B?Z2xlbm4=?=
Guest
 
Posts: n/a
Default Location of file written by WriteXML


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

  Reply With Quote
Old 15-09-2006, 04:20 PM   #2
Cowboy \(Gregory A. Beamer\)
Guest
 
Posts: n/a
Default Re: Location of file written by WriteXML

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" <glenn@discussions.microsoft.com> wrote in message
news:7F12ACDC-FDFD-46C4-A575-A03933811F89@microsoft.com...
> 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
>



  Reply With Quote
Old 15-09-2006, 04:48 PM   #3
=?Utf-8?B?Z2xlbm4=?=
Guest
 
Posts: n/a
Default Re: Location of file written by WriteXML

Gregory,

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

- Glenn

"Cowboy (Gregory A. Beamer)" wrote:

> 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" <glenn@discussions.microsoft.com> wrote in message
> news:7F12ACDC-FDFD-46C4-A575-A03933811F89@microsoft.com...
> > 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
> >

>
>
>

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off