PRB: ???? ??? ???? ?????? ???? ????? ???? ????? ??? ?? ?????? ??????? ADO ??????? ?? XML

?????? ????????? ?????? ?????????
???? ???????: 296393 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

?? ??? ??????

???????

??? ??????? ???? ADO Recordset ?????? XML <z:row/> ?? ??? ????? ???? ???? ?????? ?? ?? ??????? ???? ????? ??? ???? ?????. ?? ???? ??? ?????? ????? ??????? ?????? ????? ??? ????? ??????? ??????? (XSLT) ????? ??? ??????? ????? XML ??????? ADO ??? ????? ????. ???????? ?????? ?????? ??????? ??? @ * ??? ??????? ??????? ???? XML Path (XPath) ?????? ???? <z:row/> ??? ????? ???? ?????? ???.

??? ??? ??? ?????? ?? ?? ????? ???? ??? ??? ?????? ADO ??? ????? ??? ?????? ????? ??????? ?????????. ??? ?? ??? ????? ???? ??? ??????? ?????? XSLT ???? ??? ??????? XML ??????? ADO ???? ???? ??? <z:row/> ???? ???? ???????? ????? ?????? ???????. ????? ??????? ??? ???? ?? ???? ?????? ??? ??????? ?????? XSLT ???? ?????? @ * ????? XPath ?? <z:row/> ?????? ??? ???? ????. ??? ?????? ?????? ?????? ??? ????? NULL ??? ??????, ?? ???? ??????? ????? XSL ???? ??? ???? ??? ??????? ?? ??????.

?????

????? ??? ?????? ??? ???????. ???? ?????? "???? ?? ?????????" ?????? ??? ??? ????.

????

??? ??? ???? ????? SQL ?? ???? ???????? ????? ???? ??? ?????? T-SQL IsNull Microsoft SQL Server ? ????? ??????? ??? ?????? ????? ??????? ???? ?????? ???? ????? ???? ???? ??? ?????? ???? ?????. ?? ???? ???? ?? ??? ???? ?????? ??????? ??? ????? ???????.

??????? ????

??? ????? ?? ??? ?? ADO Recordset ??????? ?????? XML ?????? <z:row/> ???? ?? XML ???? ?? ???????. ??? ????? ?????? ?? ??? ?? ???? <z:row/> ?????? ???? ???? ?????. ??? ????? ??? XML ?? ???? ?? ?????? ?? ??? ?? ?????? ?????? ???? ?? ?????. ?? ???? ?? ????? ?????? ???? ?????? ???? ??? ???? ?????. ??? ?? ?????? ???????? ?? ??? ???? ?????? ????? ????? ??? ??? ???? ?????.

????? ????? ????? ??????

  1. ????? ???????? ????? T-SQL ?????? ?? ??? SQL Server ????? ???????? ?????? ???? ????? ????? ??? ????? ????????:
    create table Employee 
    (
    emp_id int primary key,
    emp_name varchar(20),
    hire_date datetime,
    emp_level int
    )
    
    Insert into Employee values (1,'Jack','1/1/2001',70)
    Insert into Employee values (2,'John','2/1/2001',NULL)
    Insert into Employee values (3,'Peter',NULL,NULL)
    Insert into Employee values (4,'Pam',NULL,50)
    					
  2. ????? ????? EXE ????? ???? ?? Visual Basic. ??? ????? Form1 ???? ???????.
  3. ?? ??????? ??????? ???? ??? ???? ?? ??? 2.x ?????? ?????? ActiveX Microsoft ????? ???? ????????. ???? ?? ??????? ADO ??????? 2.1 ?? ????.
  4. ????? ???? ???? CommandButton ??? Form1.
  5. ???? ?? ?? ???? ???????? ???????? ??????? ?? ????? ????? Click ??? ?????.

    ????????? ?? ???? ?????? "????? ????????" <uid>= ????? ?????? = < ???? ?????? ?????? > ??? ????? ??????? ??? ????? ??? ????????? ????????. ???? ?? ?? < ???? ???????? > ???? ???????? ???????? ?????? ??? ??????? ??? ????? ????????.
    Dim cn As ADODB.Connection
    Dim rs As New ADODB.Recordset
    
    Set cn = New ADODB.Connection
    Set rs = New ADODB.Recordset
    
    cn.Open "Provider=SQLOLEDB;Data Source=SQl Server;" & _
            "Initial Catalog=Database;User Id=<UID>;Password=<strong password>;"
    rs.CursorLocation = adUseClient
    rs.Open "Select * from Employee", cn, adOpenStatic, adLockReadOnly
    
    If Dir("c:\ADOXMLNULLTest.xml") <> "" Then
      Kill "c:\ADOXMLNULLTest.xml"
    End If
    
    rs.Save "c:\ADOXMLNULLTest.xml", adPersistXML
    
    rs.Close
    Set rs = Nothing
    
    cn.Close
    Set cn = Nothing
    
    MsgBox "Employee Recordset has been persisted successfully !"
    					
  6. ????? ????? ????? ADO ?? ????? cn.Open ??????? ??? ????? ?????? SQL Server ???? ????? ???? ????? ?? ?????? 1.
  7. ??? ??????? ???????. ???? ??? Command1 ??? ??? ??????? ?????? ????????? ???????? ADO Visual Basic ???? ???? ADO Recordset ?? ????? ?? ????? XML ??? ?????. ??? ????? ????? SELECT ???? ?? ??????? ??? ???? ??????? ?????? ?? ????? rs.Open ??????? ???????? ???? ??????? ?? ???? ????? ?? ?????? 1.
  8. ????? ????? ???????.
  9. ?? Microsoft Internet Explorer XML ??????? ??? ?????. ??? ?? <z:row> ????? ???? ??????? ???????. ?????? ?? ??? ????? ???? ?????? ??????? ???? ??? ???????? NULL ????? ??? ????? ???????? ????? T-SQL ?? ?????? 1. ???? ??? XML ???? ??????? ????? rs.Save ??? ???:
    <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
        xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
        xmlns:rs='urn:schemas-microsoft-com:rowset'
        xmlns:z='#RowsetSchema'>
    
    <s:Schema id='RowsetSchema'>
        <s:ElementType name='row' content='eltOnly'>
            <s:AttributeType name='emp_id' rs:number='1' rs:writeunknown='true'>
                <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10'
                 rs:fixedlength='true' rs:maybenull='false'/>
            </s:AttributeType>
            <s:AttributeType name='emp_name' rs:number='2' rs:nullable='true'
             rs:writeunknown='true'>
                <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='20'/>
            </s:AttributeType>
            <s:AttributeType name='hire_date' rs:number='3' rs:nullable='true' 
             rs:writeunknown='true'>
                <s:datatype dt:type='dateTime' rs:dbtype='timestamp' dt:maxLength='16' 
                 rs:scale='3' rs:precision='23' rs:fixedlength='true'/>
            </s:AttributeType>
            <s:AttributeType name='emp_level' rs:number='4' rs:nullable='true' 
             rs:writeunknown='true'>
                <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' 
                 rs:fixedlength='true'/>
            </s:AttributeType>
            <s:extends type='rs:rowbase'/>
        </s:ElementType>
    </s:Schema>
    <rs:data>
        <z:row emp_id='1' emp_name='Jack' hire_date='2001-01-01T00:00:00' emp_level='70'/>
        <z:row emp_id='2' emp_name='John' hire_date='2001-02-01T00:00:00'/>
        <z:row emp_id='3' emp_name='Peter'/>
        <z:row emp_id='4' emp_name='Pam' emp_level='50'/>
    </rs:data>
    </xml>
    					

    ???? ??????

  10. ??????? ????????? ?????? ?????? ???? ?? ????? rs.Open ?? ????? ????? Click ??? ????? ?? ????? SQL SELECT ???????:
    Select emp_id, emp_name,isnull(hire_date,'') as 
    hire_date,isnull(emp_level,'') as emp_level from Employee
    					
  11. ??? ??????? ???????. ???? ??? Command1 ??? ??? ??????? ?????? ????????? ???????? ADO Visual Basic ???? ???? ADO Recordset ?? ????? ?? ????? XML ??? ?????.
  12. ?? Internet Explorer ???? ??? XML ???????. ??? ?? <z:row> ?????. ???? ?? ???? ??? ????? ????? ???? ?????. ????? ??? ?????? ??????? ?????? T-SQL IsNull ?????? ???? ???? ??????? ??? ?????? ????? ?? ??????? hire_date ?? emp_name. ???? ??? XML ??????? ??? ???:
    <xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
        xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
        xmlns:rs='urn:schemas-microsoft-com:rowset'
        xmlns:z='#RowsetSchema'>
    
    <s:Schema id='RowsetSchema'>
        <s:ElementType name='row' content='eltOnly'>
            <s:AttributeType name='emp_id' rs:number='1' rs:writeunknown='true'>
                <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' 
                 rs:fixedlength='true' rs:maybenull='false'/>
            </s:AttributeType>
            <s:AttributeType name='emp_name' rs:number='2' rs:nullable='true' 
             rs:writeunknown='true'>
                <s:datatype dt:type='string' rs:dbtype='str' dt:maxLength='20'/>
            </s:AttributeType>
            <s:AttributeType name='hire_date' rs:number='3'>
                <s:datatype dt:type='dateTime' rs:dbtype='timestamp' 
                 dt:maxLength='16' rs:scale='3' rs:precision='23' rs:fixedlength='true'
                 rs:maybenull='false'/>
            </s:AttributeType>
            <s:AttributeType name='emp_level' rs:number='4'>
                <s:datatype dt:type='int' dt:maxLength='4' rs:precision='10' 
                 rs:fixedlength='true' rs:maybenull='false'/>
            </s:AttributeType>
            <s:extends type='rs:rowbase'/>
        </s:ElementType>
    </s:Schema>
    
    <rs:data>
        <z:row emp_id='1' emp_name='Jack' hire_date='2001-01-01T00:00:00' emp_level='70'/>
        <z:row emp_id='2' emp_name='John' hire_date='2001-02-01T00:00:00' emp_level='0'/>
        <z:row emp_id='3' emp_name='Peter' hire_date='1900-01-01T00:00:00' emp_level='0'/>
        <z:row emp_id='4' emp_name='Pam' hire_date='1900-01-01T00:00:00' emp_level='50'/>
    </rs:data>
    </xml>
    					

???????

???? ???????: 296393 - ????? ??? ??????: 28/???? ??????/1435 - ??????: 3.3
????? ???
  • Microsoft ActiveX Data Objects 2.1
  • Microsoft ActiveX Data Objects 2.1 Service Pack 1
  • Microsoft ActiveX Data Objects 2.1 Service Pack 2
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft Visual Basic 5.0 Enterprise Edition
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5
  • Microsoft Visual Basic 5.0 Professional Edition
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft SQL Server 7.0 Standard Edition
  • Microsoft SQL Server 7.0 Service Pack 1
  • Microsoft SQL Server 7.0 Service Pack 2
  • Microsoft SQL Server 7.0 Service Pack 3
????? ??????: 
kbnosurvey kbarchive kbmt kbmsxmlnosweep kbprb KB296393 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????296393

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com