Click here to Skip to main content
15,889,116 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Design question about access to database. Pin
Member 116832513-Sep-15 2:19
Member 116832513-Sep-15 2:19 
GeneralRe: Design question about access to database. Pin
GuyThiebaut3-Sep-15 2:25
professionalGuyThiebaut3-Sep-15 2:25 
Questioninsert one data table to another Pin
dha NAA1-Sep-15 19:10
dha NAA1-Sep-15 19:10 
AnswerRe: insert one data table to another Pin
Wendelius1-Sep-15 19:50
mentorWendelius1-Sep-15 19:50 
Questionmake report Pin
Joebpn131-Aug-15 18:11
Joebpn131-Aug-15 18:11 
AnswerRe: make report Pin
Richard MacCutchan31-Aug-15 20:57
mveRichard MacCutchan31-Aug-15 20:57 
AnswerRe: make report Pin
ZurdoDev2-Sep-15 5:25
professionalZurdoDev2-Sep-15 5:25 
QuestionSQL Linq, IQueryable, Join and multiple contains Pin
jkirkerx26-Aug-15 10:28
professionaljkirkerx26-Aug-15 10:28 
I'm using the example provided earlier in a previous post of mine.
I want to convert this sql linq statement into a queryable, so I can adjust the take and skip,
But I can't figure out how to Join and do Multiple contains using IQueryable.

So I wrote this which works, but now I only want to take the data I need, and not the whole table that matches. I thought I needed to go IQueryable for the Take and Skip, not being to add that to the code below. If I'm wrong, please let me know.
Dim p_pageIndex as integer = 1
Dim p_pageOffset as integer = 10
Dim p_SearchQuery as String = "Kneepads"
Using context As New DBContext()

Dim pResults = _
(
    From pi In context.ProductInfo
    Join pik In context.ProductInfo_Keywords On pik.ProductID Equals pi.ProductID
    Where pik.Keywords.Contains(p_SearchQuery.Trim) _
    Or pik.Stream.Contains(p_SearchQuery.Trim) _
    Or pi.PartNumber.Contains(p_SearchQuery.Trim)
    Order By pi.PartNumber, pi.SDescription, pi.Description Descending
    Select
        pi.ProductID,
        pi.CategoryID,
        pi.SubCategoryID,
        pi.SDescription,
        pi.Description,
        pi.Thumbnail,
        pi.PartNumber,
        pi.Price    
)

In the example above, I have multiple contains from 2 tables that are Joined, I can't figure out the wording for the Join or multiple contains. the multiple OrderBy's was from a previous version in TSQL where I used ORDER By RANK
Dim context As New DBContext()
Dim items As IQueryable(Of PRODUCTINFO) = context.ProductInfo

'Sort
items = items.OrderByDescending(Function(m) m.PartNumber).OrderByDescending(Function(m) m.SDescription).OrderByDescending(Function(m) m.Description)

'Filter by Rank
items = items.Where(Function(m) m.PartNumber.Contains(p_SearchQuery))

'Get a Single Page of Data
If (p_pageIndex = 1) Then
   items = items.Take(p_pageOffset)
Else
   items = items.Skip((p_pageIndex - 1) * p_pageOffset).Take(p_pageOffset)
End If

pResults = _
   items.AsEnumerable().Select(Function(pi) New searchIndex With
   {
       pi.ProductID,
       pi.CategoryID,
       pi.SubCategoryID,
       pi.SDescription,
       pi.Description,
       pi.Thumbnail,
       pi.PartNumber,
       pi.Price
   }
)

QuestionEasy to use VB.net code with Tesseract 3.02 Pin
ezio200024-Aug-15 23:54
ezio200024-Aug-15 23:54 
AnswerRe: Easy to use VB.net code with Tesseract 3.02 Pin
Eddy Vluggen31-Aug-15 7:09
professionalEddy Vluggen31-Aug-15 7:09 
GeneralConversion from C# to VB.Net Pin
James Frimpong24-Aug-15 11:42
James Frimpong24-Aug-15 11:42 
GeneralRe: Conversion from C# to VB.Net Pin
Dave Kreskowiak24-Aug-15 13:13
mveDave Kreskowiak24-Aug-15 13:13 
QuestionExport Vb.net Datagridview to Microsoft Excel 2013 Pin
Benniiit24-Aug-15 5:09
Benniiit24-Aug-15 5:09 
AnswerRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
Eddy Vluggen24-Aug-15 5:23
professionalEddy Vluggen24-Aug-15 5:23 
GeneralRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
Benniiit24-Aug-15 7:54
Benniiit24-Aug-15 7:54 
GeneralRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
Eddy Vluggen24-Aug-15 8:06
professionalEddy Vluggen24-Aug-15 8:06 
AnswerRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
ChandraRam24-Aug-15 5:27
ChandraRam24-Aug-15 5:27 
GeneralRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
Benniiit24-Aug-15 7:55
Benniiit24-Aug-15 7:55 
GeneralRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
ChandraRam25-Aug-15 3:44
ChandraRam25-Aug-15 3:44 
GeneralRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
Benniiit25-Aug-15 7:14
Benniiit25-Aug-15 7:14 
GeneralRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
ChandraRam25-Aug-15 7:55
ChandraRam25-Aug-15 7:55 
AnswerRe: Export Vb.net Datagridview to Microsoft Excel 2013 Pin
GuyThiebaut28-Aug-15 4:39
professionalGuyThiebaut28-Aug-15 4:39 
QuestionGood freeware barcode reader library Pin
vincentvdm22-Aug-15 22:04
vincentvdm22-Aug-15 22:04 
AnswerRe: Good freeware barcode reader library Pin
Eddy Vluggen24-Aug-15 5:27
professionalEddy Vluggen24-Aug-15 5:27 
QuestionAdd a DTPicker in a Column of grid in vb6.0 Pin
Anand_@ndy21-Aug-15 19:08
Anand_@ndy21-Aug-15 19:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.