Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
GFR_2009
Old
#1  
Member - OP
Thanks Meter 0
Posts: 37
Join Date: Oct 2009
Default [Q] LINQ to XML - help need from SQL

Hi there,

I'm porting an app which uses SQL to query a SQLCE db.

Now under WP7 I switched over to XML files.

Can anyone help me to "translate" the following SQL sentence to Linq to XML ?

Code:
        Dim SQL As String = String.Empty
        Dim USERENTRY As String = String.Empty

        SQL = "SELECT Info.INFO_COMMENTS FROM Names INNER JOIN Info ON Names.NAME_ID = Info.INFO_NAME_ID "
        SQL = SQL + "WHERE (Names.PARENTS_NAME_ID = " & "'" & USERENTRY & "') "
        SQL = SQL + "GROUP BY Info.INFO_COMMENTS "
        SQL = SQL + "ORDER BY Info.INFO_COMMENTS"
My skills are very low right now to deal with this...

On the other hand, if someone can point me to a some kind of tool to make the conversion or a great tutorial, that will be great too!

Thanks in advance for any help.

Cheers
 
timfoster
Old
#2  
Member
Thanks Meter 0
Posts: 49
Join Date: Feb 2007
I'm not Linc expert, but the quickest way to get your sql server output into an xml format is to use the FOR XML statement:

SELECT * FROM TABLE FOR XML

Whether this is the correct syntax for Linc, I don't know, but it may point you down the right path.
Google "sql server for xml"
 
The_badger_man
Old
#3  
Junior Member
Thanks Meter 0
Posts: 1
Join Date: Dec 2009
Hello,

Your SQL request depends on your db schema. The Linq to XML request over a XML will depend on the XML structure.
So we need to see your XML file to help you.
 
DaveShaw
Old
#4  
DaveShaw's Avatar
Retired Senior Moderator + Wiki Bureaucrat
Thanks Meter 286
Posts: 8,703
Join Date: Dec 2007
Location: Huddersfield
Quote:
Originally Posted by The_badger_man View Post
Hello,

Your SQL request depends on your db schema. The Linq to XML request over a XML will depend on the XML structure.
So we need to see your XML file to help you.
As the Badger says, post some sample XML and we can take a look...

Also, check out Linqpad for a collection of Linq To Xml samples and a great way to learn Linq in general (it will change your coding )
--Retired.
 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

report this ad
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...