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?

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?

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;"

I'm no vb.net programmer, but...
did you try:

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

Sorry if I didn't get the quotes completely correct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.