Want to query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • christyjs
    New Member
    • Jul 2016
    • 19

    Want to query

    Hi alL,

    I have three dropdownlists for the filters the datagrid,
    like QUALIFICATION, SKILLSET, STATUS..

    now if i have selected on the dropdown of ddlqualificatio n, but ddlstatus and ddlskilsets are in 'ALL' position, and same like that STATUS and SKILLSET.. i wrote the following query eith the if condition

    Dim sSQL As String = (" Select ResumeId, FirstName + ' , ' + LastName AS Name, " & _
    " Phone1, Email, Skillset, Qualification, case EmailFlag when '1' then 'Sent' when '0' then 'Not Sent' else 'Not Sent' end As EmailFlag,tblst atus.Status " & _
    " from tblresume INNER JOIN tblstatus on tblstatus.Statu sid=tblresume.s tatus where 1=1")
    connection.Open ()

    If skillset <> "0" Then
    sSQL &= " And skillset like(" & skillset & ") "
    End If

    If Qualification <> "0" Then
    sSQL &= " and Qualification like(" & Qualification & ") "
    End If
    If Status > 0 Then
    sSQL &= " and tblresume.Statu s like(" & Status & ") "
    End If
    sSQL &= " ORDER BY Name ASC "



    its working but my problem is, if i was selected qualification is 3 but the status is in ALL Position of my status dropdown,... i didnt get the exact anz... pls help me..


    Thanks in advance..
  • PhilOfWalton
    Recognized Expert Top Contributor
    • Mar 2016
    • 1430

    #2
    I know nothing about SQLServer, but assuming there is a wildcard character (It's * in DOS & Access, and may be % in SQLServer), I think the statements should be something like.

    Code:
    If skillset <> "0" Then
        sSQL &= " And skillset like(" & skillset & ") "
    Else
        sSQL &= " And skillset like % "
    End If
    Where % is whatever wildcard is recognised.

    Wild Guess

    Phil

    Comment

    Working...