Help with preparedsqlStatement

Hi,
I have many times using PreparedSQLStatement on linux and its worked normal.
now I need to do it on Windows, but does not work, the code seems to be fine.

dim ps as MySQLPreparedStatement

mDB = New MySQLCommunityServer
mDB.Host = "10.10.10.1"
mDb.UserName = "admin_office"
mDb.Password = "123456"
mDB.Port = 3306
mDb.DatabaseName = "admin_shop"

If mDb.Connect Then
  mIsConnected = True
  MessageBox "conneceted"
Else
  mIsConnected = False
End If

ps=mDB.Prepare("UPDATE livereport2 SET sales = ?, waktu=? WHERE shop = ?")

ps.BindType(0,MySQLPreparedStatement.MYSQL_TYPE_STRING)
ps.BindType(1,MySQLPreparedStatement.MYSQL_TYPE_STRING)
ps.BindType(2,MySQLPreparedStatement.MYSQL_TYPE_STRING)

ps.Bind(0,t_wad.text)
ps.Bind(1,"00:00")
ps.Bind(2,"wad")

ps.SQLExecute

I still dont where are the problem.

any helps?

thanks
arief

If you use the API2 calls then they do the prepare for you:

Var rs as Rowset, db as SQLiteDatabase, sql as string, ii, qq as integer

ii = 33
qq = 8

sql = "select a, b from mytable where i=?1 and q=?2"
rs  = db.SelectSQL (sql, ii, qq)

I don’t immediately see a problem. What does “does not work” mean in this context? Do you get an error message? Incorrect results? Have you checked the error properties?

Hi,
I have tried to put a msgbox, but seems the code is not executed.
The Original project file was created by xojo 2014 r4.3, I do upgrading to 2021 r1.1 version, because its not running then I downgrade to 2018 r4. but still dont work.

if its compiled in linux its running smoothly.

thanks
arief

Have you tied this in a new 2013r3.1 project with no additional changes?

What version of mysql server are you using and on which platform and version is it hosted?

Do you see the “conneceted” message box?

Hi,

The ‘connected’ Message is shown, I do remoteSQL from a Cloud VPS.
Okay, will try the 2013 r3.1

thanks
regards
arief