desktop app crash on SQLExecute

I have small desktop app in windows that connect to mssqlserver. I can make new record with db.InsertRecord
and get recorsets with rs = db.SQLSelect, but if I try prepared statement, app crash in SQLExecute line.
Both of these crash my app. These work fine in Mysql but I i need it also in MSSQL.
Is there something I need ot change or what?

Dim stmt As MSSQLServerPreparedStatement = db.Prepare("DELETE FROM users WHERE uid = ?") stmt.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING) stmt.Bind(0, Listbox2.Text) stmt.SQLExecute

Dim stmt As MSSQLServerPreparedStatement = db.Prepare("DELETE FROM osaaminen WHERE oid = ?") stmt.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_INT) stmt.Bind(0, Listbox1.RowTag(Listbox1.ListIndex).IntegerValue) stmt.SQLExecute

Thanks!

Your code looks good and there’s evidence of that based on your statement that similar code works with MySQL. It’s probably a bug in the MSSQLServer database plugin. What happens when you run/debug your app from the IDE? Which version of Xojo are you running and on what operating system platform? Answers to those questions may help myself, others and most importantly, Xojo engineers to diagnose the problem.

I run it on ide and it crash, can’t get even db.ErrorMessage. Windows 7 (32bit), Xojo 4.1.
I have this after stmt.SQLExecute, but it never go that far…

 if db.Error Then
    MsgBox(db.ErrorMessage)
    Return
 end if

text encoding broken of the text you bind?

That other bind is integer, is it possible?

I don’t use Prepared Statments much myself… but at first glance … should this not be

Dim stmt As MSSQLServerPreparedStatement = db.Prepare("DELETE FROM users WHERE uid =' ?'")

to quote your input string so the statement reads properly? (ie. single quotes around the ?)

I just finished a project that required a connection to MSSQL… I started using the Xojo plugin but ran into numerous crashes… once I switched to the MBS Plugin the problems went away…

This might not be your exact problem but see feedback #16702.

Dave - no, prepared statements don’t need quotes round the ?s.

I can replace these with:

db.SQLExecute("DELETE FROM users WHERE uid = '" + Listbox2.Text + "'")

and

db.SQLExecute("DELETE FROM osaaminen WHERE oid = " + str(Listbox1.RowTag(Listbox1.ListIndex).IntegerValue))

and those works.
I already have web project done for MySQL and I’m changing it now to MSSQL, I’m thinking if I run to more bugs (like James Meyer told), is it wise to continue with this or purchase this The MBS Xojo (Real Studio) SQL Plugin? This desktop application was just little test before and I already run in bugs.
If I change now to MBS, is there going to be totally different syntax? Just wondering what would be best/easiest way to go?

Jukka

…and I made Feedback Case 32119

MBS has 2 different classes that you can use with their SQL plugin… one of them the Xojo database class and its methods… which is what I used… and was thus real easy to switch to…

The other class is very different. see: http://www.monkeybreadsoftware.de/realbasic/plugin-sql.shtml