I have in mysql table - products (product_id int, name varchar, description text).
I use latest ODBC driver to connect to mysql from excel (VBA) with parametrized query:
dim DCONT as ADODB.Connection
set DCONT = new ADODB.Connection
DCONT.open "DSN=myDSN"
set cmd = new ADODB.command
cmd.commandtext = "SELECT product_id, name FROM products WHERE name LIKE ?"
set param1=cmd.createparameter("@strName", advarchar, adparaminput, 30, "%testvalue%"
cmd.parameters.append param1
cmd.activeconnection = DCONT
dim rsRecords = new ADODB.recordset
rsRecords.open cmd
This code return requested records correctly. When I change commandtext to (query included the field description from table (field type text))
cmd.commandtext = "SELECT product_id, name, description FROM products WHERE name LIKE ?"
it returns No record. In the same way when I use this query
cmd.commandtext = "SELECT * FROM products WHERE name LIKE ?"
it returns No record.
Next code without parametrized query returns requested record. It means there is a problem with returning records only by use parametrized query.
dim DCONT as ADODB.Connection
set DCONT = new ADODB.Connection
DCONT.open "DSN=myDSN"
set cmd = new ADODB.command
cmd.commandtext = "SELECT product_id, name, description FROM products WHERE name LIKE '%testvalue%'"
cmd.activeconnection = DCONT
dim rsRecords = new ADODB.recordset
rsRecords.open cmd
Any advice please?