PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Location of file written by WriteXML
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
Location of file written by WriteXML
![]() |
Location of file written by WriteXML |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
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 |
|
|
|
#2 |
|
Guest
Posts: n/a
|
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 > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
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 > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

