8 Replies - 3175 Views - Last Post: 07 December 2012 - 12:33 PM Rate Topic: -----

#1 hugoriffic  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 185
  • Joined: 16-September 09

.XmlDataDocument() Obsolete Error Message

Posted 06 December 2012 - 11:37 AM

I am writing a program in which you enter a number into a simple text box, click a submit button, and it is supposed to display the information from a database that is contained within the number you clicked.
So, if you enter "3" the name, address, number, etc of this person is supposed to display on the webpage.

The button is using javascript. And the page it is reading is written in VB. I get the following error: .XmlDataDocument() is Obsolete; will be replaced in a newer version.

This is the only error message I get when I run debug. The program does not work. Could someone please take a look and see what might be wrong?

The code for this program is as such:

Javascript
 <script language="javascript" type="text/javascript">

        function btnSearch_onclick() {
            var docSubmit = new ActiveXObject("MSXML2.DOMDocument");
            docSubmit.loadXML("<?xml version='1.0'?><request><customerID>" + txtCustID.value + "</customerID></request>")


            var objSocket = new ActiveXObject("MSXML2.XMLHTTP");
            objSocket.open("POST", "Lookup.aspx", false)
            objSocket.send(docSubmit)
           

            lblFirstName.innerHTML = objSocket.responseXML.selectSingleNode("//FirstName").firstChild.nodeValue
            lblLastName.innerHTML = objSocket.responseXML.selectSingleNode("//LastName").firstChild.nodeValue
            lblAddress.innerHTML = objSocket.responseXML.selectSingleNode("//Address").firstChild.nodeValue
            lblCity.innerHTML = objSocket.responseXML.selectSingleNode("//City").firstChild.nodeValue
            lblState.innerHTML = objSocket.responseXML.selectSingleNode("//State").firstChild.nodeValue
            lblZip.innerHTML = objSocket.responseXML.selectSingleNode("//Zip").firstChild.nodeValue

        }
    </script>



VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim docReceived As New System.Xml.XmlDataDocument()
        docReceived.Load(Request.InputStream)

        Dim CustomerID = docReceived.SelectSingleNode("//customerID").FirstChild.Value

        Dim myConnection As New System.Data.OleDb.OleDbConnection
        Dim myConnectionString As String
        myConnectionString = "Provider = Microsoft.Jet.OLEDB.4.0;Data Source = " & _
        Server.MapPath("customer.mbd")
        myConnection.ConnectionString = myConnectionString

        Dim strSQL As String
        strSQL = "Select * From CustomerInfo where CustomerID = " & CustomerID

        Dim myAdapter As New System.Data.OleDb.OleDbDataAdapter(strSQL, myConnection)

        Dim myDataSet As New System.Data.DataSet("CustomerInfo")

        Dim intRecords As Integer
        intRecords = myAdapter.Fill(myDataSet, "Customer")

        Response.ContentType = "text/xml"

        If intRecords > 0 Then
            myDataSet.WriteXml(Response.OutputStream)
        Else
            Response.Write("<?xml version='1.0'?><customer><FirstName>Not Found</FirstName><LastName>***</LastName><Address>***</Address><City>***</City><State>***</State><Zip>***</Zip><Phone>***</Phone><Email>***</Email></customer>")
        End If

        myDataSet.WriteXml(Response.OutputStream)

        myConnection.Close()
        myAdapter.Dispose()
        myConnection.Dispose()

    End Sub




Is This A Good Question/Topic? 0
  • +

Replies To: .XmlDataDocument() Obsolete Error Message

#2 hugoriffic  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 185
  • Joined: 16-September 09

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 09:16 AM

Is there anything else you would need to see from this program to figure out what might be going wrong?? I deleted the entire program and started from scratch and get the same error message.
Was This Post Helpful? 0
  • +
  • -

#3 lucky3  Icon User is offline

  • Friend lucky3 As IHelpable
  • member icon

Reputation: 231
  • View blog
  • Posts: 769
  • Joined: 19-October 11

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 10:48 AM

Perhaps you'll find something useful here.
Was This Post Helpful? 0
  • +
  • -

#4 hugoriffic  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 185
  • Joined: 16-September 09

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 10:54 AM

Did that already. I have not studied VB so the recommendations suggested make no sense to me.
Was This Post Helpful? 0
  • +
  • -

#5 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1067
  • View blog
  • Posts: 4,174
  • Joined: 02-July 08

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 11:11 AM

The XmlDocument class is very similar and would have a few things to change.
Was This Post Helpful? 0
  • +
  • -

#6 hugoriffic  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 185
  • Joined: 16-September 09

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 11:21 AM

Would this work? Dim docReceived As New System.Xml.XmlDocument(customer.mbd)
Was This Post Helpful? 0
  • +
  • -

#7 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1067
  • View blog
  • Posts: 4,174
  • Joined: 02-July 08

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 11:24 AM

Look at the parameter(s) it takes - sure filename is in there, but it is the wrong file type. It expects an .XML file. You can load the Db into a dataset and have it write-out an XML file. What is the main purpose of what your doing?
Was This Post Helpful? 0
  • +
  • -

#8 hugoriffic  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 185
  • Joined: 16-September 09

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 11:33 AM

The main purpose of the program is to read info from a database and display that info on a webpage.
There is no .XML file associated with this program as far as I can see. There is an HTML page, a .ASPX page, and the database.
I can't find where the XML format is coming from.
Was This Post Helpful? 0
  • +
  • -

#9 _HAWK_  Icon User is offline

  • Master(Of Foo)
  • member icon

Reputation: 1067
  • View blog
  • Posts: 4,174
  • Joined: 02-July 08

Re: .XmlDataDocument() Obsolete Error Message

Posted 07 December 2012 - 12:33 PM

Then you looking at ASPX Databinding.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1