Results 1 to 2 of 2

Thread: Struggling with LINQ to Dataset

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2006
    Posts
    746

    Struggling with LINQ to Dataset

    Hi,

    I'm just getting my feet wet with LINQ but am struggling to convert this SQL statement to LINQ.

    Code:
    Dim SQLString As String = "SELECT MESSAGE_ID FROM " & Schema & _
                                           ".PPM_TRANSFER_EMAIL WHERE TO_CHAR(IMPORTED_DATE,'YYYY/MM/DD') <= '" & _
                                            DeletionDate.ToString("yyyy/MM/dd") & "' AND IMPORTED = 'Y' AND FILE_NAME LIKE '" & _
                                            mb & "%'"
    I have a Dataset that already contains all the data from the PPM_TRANSFER_EMAIL table so it seems silly to query the database again when I can use LINQ to query the dataset. I just can't figure out the syntax.
    ManagePC - the all-in-one PC management and inventory tool

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Struggling with LINQ to Dataset

    should look something like this:
    Code:
    Dim MessageID_List  As List(Of String) = yourdataset.datatablename.WHERE(function (c) c.Imported_Date <= DeletionDate andalso c.Imported = "Y" AndAlso c.File_Name.StartsWith(mb)).Select(function (f) f.Message_ID).ToList()
    I think that will work....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

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