How to replace string with variable in substring?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • game2d
    New Member
    • Apr 2013
    • 59

    #1

    How to replace string with variable in substring?

    How to replace string with variable in substring? btw im using vb

    I have a below query that work fine but I just want to replace "ra*" with a variable. How can I do this?

    Code:
    SELECT DISTINCT a.[rank], b.Description
        FROM CONTAINSTABLE(myTable, *, '"ra*'") AS a
            INNER JOIN myTable AS b ON a[key] = b.ID
                 ORDER BY a.rank desc;
    Below is what I tried so far but it doesnt work. it treat as '"ra"' and not '"ra*"'. Any idea how can I fix this?

    Code:
    Dim mkey As String = "ra"
    Dim query As String = "SELECT DISTINCT a.[rank], b.Description
            FROM CONTAINSTABLE(myTable, *, '" & mKey & "*') AS a
                INNER JOIN myTable AS b ON a[key] = b.ID
                    ORDER BY a.rank desc;"
Working...