Results 1 to 7 of 7

Thread: [RESOLVED] [2005] Database->?->LINQ->XML

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved [RESOLVED] [2005] Database->?->LINQ->XML

    To cut to the point, I will have to use "LINQ to XML" to make an XML document, and the data I will use will come from a database. But the assignment says nothing about how to get the data from the database.

    Is there any ASP.NET natural way to pull this off as you see it? Is it maybe possible to pragmatically pull data out of a object datasource maybe? Or would that be like jumping over the fence to fetch something that is already in your back yard?


    - ØØ -

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [2005] Database->?->LINQ->XML

    Well you can connect to a database and run queries all from LINQ. check out this guide from MS: http://msdn2.microsoft.com/en-us/library/bb425822.aspx
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: [2005] Database->?->LINQ->XML

    Thanks, but I see this document is written for .NET 3.5. Was this even implemented in VS 2005?


    - ØØ -

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [2005] Database->?->LINQ->XML

    Quote Originally Posted by NoteMe
    Thanks, but I see this document is written for .NET 3.5. Was this even implemented in VS 2005?


    - ØØ -
    Well you posted stated you were using 2005 but LINQ is only in 2008 and you had said you wanted to use LINQ to Xml so I assumed you put the wrong version.

    Yeah, if you want to use LINQ then you have to have 2008. If you're just looking for a way to get data from a database then you can use the built in .Net classes or try out the Enterprise Library Blocks from Microsoft which makes database access a breeze.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Database->?->LINQ->XML

    Create your 'entity' class to mirror what's in your table set, make sure it inherits from DataContext, then use your LINQ on it. Because you can then shape the data, you can create a new XDocument, XMLDocument, whatever you want as the 'returned' item from the query. Then save it.

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: [2005] Database->?->LINQ->XML

    Well you posted stated you were using 2005 but LINQ is only in 2008 and you had said you wanted to use LINQ to Xml so I assumed you put the wrong version.
    No I ment 2005, and I ment LINQ. Maybe not in production environments, but for Uni using LINQ in 2005 works well using the May 2006 CTP.

    Create your 'entity' class to mirror what's in your table set, make sure it inherits from DataContext, then use your LINQ on it. Because you can then shape the data, you can create a new XDocument, XMLDocument, whatever you want as the 'returned' item from the query. Then save it.
    I would never have figguered out the save part my self No really, cheers. Believe it or not, I got it working. So it seems I managed the whole semester while working 100% in 3months + Wooohooo. No I will use the rest of the year reading poetry

    Cheers,
    - ØØ -

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] [2005] Database->?->LINQ->XML

    Mind sharing some code then?

    Let's see what you've done. Unless it's highly confidential.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width