no responses so I’m adding onto this with the hopes that someone has overcome this.
I had been testing with ODBC and with MBS to connect from my Mac to MSSQL server and am not able to insert more than 8,000 characters regardless of what kind of column I try to make. I’ve tried all options.
I decided to try using the XOJO plugin on Windows and it’s worse. I’m only able to summit 255 characters.
Someone must have used MSSQL with Xojo and needed to store more than 255 characters.
I had this issue on Windows and MSSQL to store the HTML text of an email. I had to change the field format to …MAX and use a plain INSERT/UPDATE command with the field value inside quote marks. Naturally I also had to escape the text first. I was constantly getting errors using my normal MBS Prepared Statement method. There may have been a better way, but this worked.
dim t as string = "Hello World "
while len(t) < 9000
t = t + "xxx "
wend
dim p as PreparedSQLStatement = con.Prepare("UPDATE TestTable SET pLongText=? WHERE pInt=1")
p.Bind(0, t)
p.BindType(0, SQLPreparedStatementMBS.kTypeClob)
p.SQLExecute
dim sql as string = "SELECT pLongText From TestTable;"
dim r as RecordSet = con.SQLSelect(Sql)
if r<>nil then
dim x as string = r.IdxField(1).StringValue
MsgBox str(len(x))
else
MsgBox "Failed to query."
end if
When I let plugin decide type automatically, I get this error:
HY104 [Microsoft][SQL Server Native Client 11.0]Invalid precision value
so 9000 characters don’t fit in a text data type.
But if I use the BindType line with SQLPreparedStatementMBS.kTypeClob, it works.