PDA

View Full Version : SQL Express update failed



phabio
2014-04-19, 11:05
Hi all.
I've created a SQL Express Database with my table and my data.
I've cretaed VT and created a page to edit a table.

If I try to update data with a string that contain "'" character, Lianja get error: "Record as been chaged by".

the single quote char is used as a string delimiter in SQL Qxpress command..

is a bug?

this is the debug_client log.



File ../../lib_dbw.cpp at line 5328 dbw_cursoradaptor() wka=0 command=ALLOWUPDATE
File ../../rco_cursoradaptor.cpp at line 281 wka=0 command=ALLOWUPDATE
File ../../lib_dbw.cpp at line 5328 dbw_cursoradaptor() wka=0 command=UPDATE
File ../../rco_cursoradaptor.cpp at line 281 wka=0 command=UPDATE
File ../../rco_cursoradaptor.cpp at line 2625 setTables(232892568) table=abicab
File ../../rco_cursoradaptor.cpp at line 3481 performUpdate()
File ../../rco_cursoradaptor.cpp at line 3502 table=abicab
File ../../rco_cursoradaptor.cpp at line 3506 m_dbtype=MSSQL
File ../../rco_cursoradaptor.cpp at line 3510 primarykey=''
File ../../rco_cursoradaptor.cpp at line 3512 where=isnull(ABICAB,'')='0100001000' and isnull(BANCA,'')='BANCA D'ITALIA - TORINO' and isnull(PIAZZA,'')='VIA ARSENALE 8' and isnull(CAP,0)=10121 and isnull(LOCALITA,'')='TORINO' and isnull(COD_PROV,'')='TO'
File ../../rco_cursoradaptor.cpp at line 3525 cmd=update abicab set where isnull(ABICAB,'')='0100001000' and isnull(BANCA,'')='BANCA D'ITALIA - TORINO' and isnull(PIAZZA,'')='VIA ARSENALE 8' and isnull(CAP,0)=10121 and isnull(LOCALITA,'')='TORINO' and isnull(COD_PROV,'')='TO'
File ../../rco_cursoradaptor.cpp at line 3752 execTally() cmd=update abicab set where isnull(ABICAB,'')='0100001000' and isnull(BANCA,'')='BANCA D'ITALIA - TORINO' and isnull(PIAZZA,'')='VIA ARSENALE 8' and isnull(CAP,0)=10121 and isnull(LOCALITA,'')='TORINO' and isnull(COD_PROV,'')='TO'
File ../../rco_cursoradaptor.cpp at line 3777 numRowsAffected()=-1 error=[Microsoft][SQL Server Native Client 11.0][SQL Server]Sintassi non corretta in prossimità della parola chiave 'where'. [Microsoft][SQL Server Native Client 11.0][SQL Server]Virgoletta di chiusura mancante dopo la stringa di caratteri ''. QODBC3: Unable to execute statement errornumber=105
File ../../rco_cursoradaptor.cpp at line 3527
update abicab set where isnull(ABICAB,'')='0100001000' and isnull(BANCA,'')='BANCA D'ITALIA - TORINO' and isnull(PIAZZA,'')='VIA ARSENALE 8' and isnull(CAP,0)=10121 and isnull(LOCALITA,'')='TORINO' and isnull(COD_PROV,'')='TO'
nr_rows=0

Fabio

HankFay
2014-04-19, 14:16
Hi Phabio,

In MSSQL you escape single quotes by doubling them.

So:

1) get the cursoradapter object for the VT loCA = cursoradapter("myVT")
2) set the quotestring value to two single quotes loCA.quotestring = "''"

hth,

Hank

lianjasupport
2014-04-19, 20:49
Or specify it in the VT properties clause.

yvonne.milne
2014-04-22, 03:23
Or specify it in the VT properties clause.

Property is QuoteString as in cursoradapter (http://www.lianja.com/doc/index.php/CursorAdapter).QuoteString.

phabio
2014-04-22, 03:43
Thanks all.

But I need to insert this property into the VT.. when i right click on a VT and I select "Modify Virtual table"...
I have this table on a section.

yvonne.milne
2014-04-22, 04:00
Hi Fabio,

Yes, just include it in the Properties list in the 'Modify ...':

quotestring='';...

(http://www.lianja.com/community/showthread.php?1692-String-quoting-with-SQL-Virtual-Tables)

Regards,

Yvonne

phabio
2014-04-22, 04:34
Yes, work fine!
Too much post to keep in mind.. :-)

Thank you