locked
Simple LINQ to XML Question? RRS feed

  • Question

  • below is my XML file. I need the syntax for the LINQ SQL Statement: 
    SELECT Table FROM MyFile 
    WHERE Server = 'MyServer' AND Database = 'MyDatabase'
    <?xml version="1.0" encoding="utf-8" ?>
    <Servers>
     <Server Name="ALTINWS\SQLExpress" UserName="sa" Password="sa">
     <Database Name="Delta">
      <Table>Accounts</Table>
      <Table>Users</Table>
     </Database>
     <Database Name="Alpha">
      <Table>Accounts</Table>
      <Table>Users</Table>
     </Database>
     </Server>
     <Server Name="ALTINWS" UserName="sa" Password="sa">
     <Database Name="Stocks">
      <Table>Positions</Table>
      <Table>Prices</Table>
     </Database>
     </Server>
    
    </Servers>
     
    

    • Moved by Min ZhuModerator Wednesday, August 24, 2011 8:14 AM (From:Windows Presentation Foundation (WPF))
    Friday, August 19, 2011 11:10 AM

Answers

  • Hi jay,

    Please see the code snippet below for ur query.

    Here List Collection "Tables" contains the list of all the tables in Server "ALTINWS" and Database "Stocks".

    Please mark it as an asnwer if it helps!.

    Regards,

    Parth Shah

     

    Friday, August 19, 2011 12:01 PM

All replies

  • Hi jay,

    Please see the code snippet below for ur query.

    Here List Collection "Tables" contains the list of all the tables in Server "ALTINWS" and Database "Stocks".

    Please mark it as an asnwer if it helps!.

    Regards,

    Parth Shah

     

    Friday, August 19, 2011 12:01 PM
  • Hi Jay,

    Any updates on this.

    If ur query is resolved then pls close this post and mark it as an answer.

    Regards,

    Parth Shah

    Saturday, August 20, 2011 5:03 AM
  • Hi Jay,

    Any updates on this.

    If ur query is resolved then pls close this post and mark it as an answer.

    Regards,

    Parth Shah

    Wednesday, August 24, 2011 5:22 AM