MBS SQL - Exception on prepared statement

I am in the process of updating an old application that I have. Currently, I am running into a NillObjectException and I am not sure why this is.

here is a snippet:

dim sqlVar as Variant
dim sqlStatement as String

sqlStatement = “insert T_OBJECT_TBL(file_size, dcm_xml, study_date, study_time, study_instance_uid, series_instance_uid, sop_instance_uid, sop_class_uid, sop_transfer_syntax_uid) select :0, :1, :2, :3, :4, :5, :6, :7, :8)”

sqlVar = db.dbSQL.Prepare(sqlStatement)

db.dbPreparedSatement = sqlVar[/code]

any help would be appericated

Shouldn’t it be “insert into”?

Edit: never mind, you must be using SQL Server.

Yes, MS SQL 2014.

I am reading more on the MBS PreparedStatement which describes

[quote]Version 16.4 and newer allow you to bind BLOB fields using a Memoryblock or a String value.
Older versions only accepted string.

When passing variant for value, MemoryBlock and Strings without text encoding are converted to byte values (BLOB). Texts and Strings with encoding are converted to text values. Other types are translated as good as possible. Raises exceptions if you pass anything which is not recognized. [/quote]

Since I am using a variant… I wonder if there is something funky with the plugin.

You are using variant for a variable, which you don’t.
The described change is for passing values as variant.

Do you check whether db.dbSQL is nil?
Or check if NillObjectException has a message?

your right… db.dbSQL is nil… ok going to fix :slight_smile:

thank you!