hi have have this problem
when i use db.addRow(“TBL”,dataBaseRow) and a column of dataBaseRow contains a string within a single quote character
the value of the dataBaseRow.column is obtained by directly assigning the value through another column of a rowset obtained from a previous query
the result is this error "Unhandled DatabaseException Message: Incorrect syntax near ‘)’. "
the code is like this
dim rec as new DatabaseRow
sq=“select name , surname from usersTBL”
rs=Session.dbSource.SelectSQL(sq)
do until rs.AfterLastRow
rsd.Column(“name”).Value =rs.column(“name”).Value '//** if rs.columnn(“name”).value = “marco’s” ERROR !!
rsd.Column(“surname”).Value =rs.column(“name”).Value
Session.dbDest.AddRow(“otherTBL”,rsd)
rs.MoveToNextRow
loop
I dont know if Xojo has 100% test case coverage for API 2
Without that its hard for us to know what does / doesnt work
You’re far from the first that has used a new API 2 mechanism to find its got a bug that stops you
And then we have to revert to the old API and have autocomplete not work etc
update, in reality it does not work even with api 1.0, in fact skips the insertion of the record containing a field with inside its string value with a quote !!
and the bad thing is that it doesn’t even throw an error, I’m perplexed.
rs.field(column) returns a variant
IF that variant is NIL and you assign it to a string you get a string that contains a blank - but its an empty string NOT nil
Sub Open()
Dim v As Variant = Nil
Dim s As String = v
break
End Sub
that explains why your column ends up with a lot of blanks and no NULLS
I almost choked on reading this. I don’t even have a stupid example to show oh how this instruction is !
Oh, I know I remember a conference that dealt with life after death … As if the speaker went there and came back to tell us about it …
It looks like a (very) bad translation
I even checked the docs to be sure it was not a user created code
[quote=481384:@Emile Schwarz]I almost choked on reading this. I don’t even have a stupid example to show oh how this instruction is !
Oh, I know I remember a conference that dealt with life after death … As if the speaker went there and came back to tell us about it …
It looks like a (very) bad translation
I even checked the docs to be sure it was not a user created code
AfterLastRow: What do exists after the last row ? ;)[/quote]
I apologize for my bad English, I am trying to use google to translate from my language
the fact to focus on is that both 1.1 and 2.0 bees are used when inserting a record with the db.addrow method or the previous method, if the record contained in the database has a field containing an apex, the insertion fails
NOW , to simplify look at this code :
dB = your database connection , i use ms sql server
dim r as new DatabaseRow
r.column(“YourStringField”)=“ci’ppa”
Session.dB.AddRow(“YOURTABLE”, r )
this code fail e return "Unhandled DatabaseException Message: Incorrect syntax near ‘)’. "
ahhh. ma tu sei un francese mi domandavo chi potesse essere così cogl…e da scrivere una risposta del genere, e la risposta stà nella nazionalita.