Jim-VxE/AHK-Lib-ADOSQL

how can I use variable in this function?

Opened this issue · 5 comments

hi, VxE,thank you for your function.
how can I use variable in this function?

Gui, Add, Edit, x66 y47 w140 h30 vEdit1 gChange, type here
Change:
Gui, Submit,NoHide
msgbox,% ADOSQL( connection_string ";coldelim= `t", "
(
SELECT name, number
FROM phonenumber.csv
WHERE ab LIKE '%'+%edit1%+'%'
)")

it doesn't work,can you help me?

Hi, jrnreg. AHK has two very different ways of using variables; they don't mix, as it looks like you're trying to do. Try preparing your strings before passing them to a function, that way, you can use a msgbox to verify the value being passed to the function. E.g:

query =
(
SELECT name, number
FROM phonenumber.csv
WHERE ab LIKE '%%edit1%%'
)
MsgBox %query% ; verify
result := ADOSQL( connection_string ";coldelim= `t", query )
MsgBox %result%

It's work!!!
thank you very very very much!!!!VxE!! thank you!!! you helped me a lot!

Hi,VxE,I can't use "*" in query,
can you help me?

connection_string :=
("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.\Database1.mdb")

query =
(
SELECT name, number
FROM phonenumber
WHERE ab LIKE "*WL*";
)

MsgBox %query% ; verify

result := ADOSQL( connection_string ";coldelim= `t", query )
msgbox %result%
return
keiiz commented

jrnreg ' rather than " in your LIKE?

WHERE ab LIKE '%WL%' work.thank you.