Click here to Skip to main content
13,633,585 members

Visual Studio 2015 & .NET 4.6

 
GeneralRe: How to query database using Entity to SQL Pin
Richard Deeming12-Apr-13 3:31
professionalRichard Deeming12-Apr-13 3:31 
GeneralRe: How to query database using Entity to SQL Pin
ADSCNET12-Apr-13 3:33
memberADSCNET12-Apr-13 3:33 
GeneralRe: How to query database using Entity to SQL Pin
Richard Deeming12-Apr-13 3:50
professionalRichard Deeming12-Apr-13 3:50 
GeneralRe: How to query database using Entity to SQL Pin
ADSCNET12-Apr-13 4:03
memberADSCNET12-Apr-13 4:03 
GeneralRe: How to query database using Entity to SQL Pin
ADSCNET12-Apr-13 6:35
memberADSCNET12-Apr-13 6:35 
GeneralRe: How to query database using Entity to SQL Pin
Richard Deeming12-Apr-13 7:14
professionalRichard Deeming12-Apr-13 7:14 
GeneralRe: How to query database using Entity to SQL Pin
ADSCNET12-Apr-13 7:34
memberADSCNET12-Apr-13 7:34 
GeneralRe: How to query database using Entity to SQL Pin
Richard Deeming12-Apr-13 8:17
professionalRichard Deeming12-Apr-13 8:17 
You shouldn't need to replace the null values. Try something like this:

Dim query As IQueryable(Of Employee) = _db.DbSet_Employees

If Not String.IsNullOrWhiteSpace(Me.txtName.Text) Then
    query = From employee In query Where employee.Name1.Contains(Me.txtName.Text)
End If

If Not String.IsNullOrWhiteSpace(Me.txtFamily.Text) Then
    query = From employee In query Where employee.Family.Contains(Me.txtFamily.Text)
End If

If Not String.IsNullOrWhiteSpace(Me.txtTelephone.Text) Then
    query = From employee In query Where employee.Telephone.Contains(Me.txtTelephone.Text)
End If

Return query

Applying multiple Where clauses is the same as using AndAlso within a single clause.

The query is translated to SQL, so if you're searching on a field which is null, the record will be ignored; you won't get an exception like you would if you were executing the code in VB.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: How to query database using Entity to SQL Pin
ADSCNET12-Apr-13 9:26
memberADSCNET12-Apr-13 9:26 
GeneralRe: How to query database using Entity to SQL Pin
Richard Deeming12-Apr-13 12:34
professionalRichard Deeming12-Apr-13 12:34 
GeneralRe: How to query database using Entity to SQL Pin
ADSCNET13-Apr-13 3:06
memberADSCNET13-Apr-13 3:06 
GeneralRe: How to query database using Entity to SQL Pin
Richard Deeming15-Apr-13 1:27
professionalRichard Deeming15-Apr-13 1:27 
GeneralRe: How to query database using Entity to SQL Pin
ADSCNET15-Apr-13 1:52
memberADSCNET15-Apr-13 1:52 
Questiondeploy vsto Excel template in intranet Pin
wassim_mar2-Apr-13 0:16
memberwassim_mar2-Apr-13 0:16 
QuestionCrystal report groups Pin
Tufail Ahmad25-Mar-13 3:11
memberTufail Ahmad25-Mar-13 3:11 
Questionsnake game error, moving randomly. Pin
srinivasankrishnaa28-Feb-13 3:57
membersrinivasankrishnaa28-Feb-13 3:57 
AnswerRe: snake game error, moving randomly. Pin
Pete O'Hanlon28-Feb-13 4:04
protectorPete O'Hanlon28-Feb-13 4:04 
GeneralRe: snake game error, moving randomly. Pin
srinivasankrishnaa28-Feb-13 4:45
membersrinivasankrishnaa28-Feb-13 4:45 
AnswerRe: snake game error, moving randomly. Pin
ryanb3120-Mar-13 1:54
memberryanb3120-Mar-13 1:54 
AnswerRe: snake game error, moving randomly. Pin
Filipe Moreira de Oliveira17-May-13 15:58
professionalFilipe Moreira de Oliveira17-May-13 15:58 
QuestionCI in TFS Pin
nitin_ion20-Feb-13 23:29
membernitin_ion20-Feb-13 23:29 
QuestionThanking Mike Meinz Pin
srinivasankrishnaa20-Feb-13 5:00
membersrinivasankrishnaa20-Feb-13 5:00 
AnswerRe: Thanking Mike Meinz Pin
Richard MacCutchan20-Feb-13 5:35
mvpRichard MacCutchan20-Feb-13 5:35 
AnswerRe: Thanking Mike Meinz Pin
Sandeep Mewara20-Feb-13 6:27
mvpSandeep Mewara20-Feb-13 6:27 
Questionfind sentence with regular expression in VS Pin
Elham M18-Feb-13 21:25
memberElham M18-Feb-13 21:25 

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.


Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.180712.1 | Last Updated 26 Mar 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid