Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » How to use Sql * Update
How to use Sql * Update [message #19632] Wed, 24 December 2008 14:47 Go to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
I'm trying to use the following code to update a sql-table:

Sql sql(session);
		
sql * Update(SqlId(sqlTable))
(NAME, customer.name)
(NUMMER, customer.number)
(PRODUKT, customer.product)
(VERSION, customer.version)
(STANDORT, customer.location)
(ANBINDUNG, customer.connection)
(BEMERKUNG, customer.comment)
.Where(ID == customer.sqlID);


I get these error:

H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1274) : error C2660: 'Upp::Ctrl::Update' : function does not take 1 arguments
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1282) : error C2228: left of '.Where' must have class/struct/union
prohibisZA: 1 file(s) built in (0:01.87), 1872 msecs / file, duration = 1919 msecs, parallelization 0%

There were errors. (0:02.48)


What went wrong?
Re: How to use Sql * Update [message #19634 is a reply to message #19632] Wed, 24 December 2008 17:45 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
Found out that this works:

Sql sql(session);
		
sql * SqlUpdate(SqlId(sqlTable))
(NAME, customer.name)
(NUMMER, customer.number)
(PRODUKT, customer.product)
(VERSION, customer.version)
(STANDORT, customer.location)
(ANBINDUNG, customer.connection)
(BEMERKUNG, customer.comment)
.Where(ID == customer.sqlID);


So is it ok to use SqlSelect, SqlInsert and SqlUpdate instead of Select, Insert and Update(which does not work)?
Re: How to use Sql * Update [message #19635 is a reply to message #19634] Thu, 25 December 2008 21:35 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, there is unfotunate nameclash with Update that usually strikes when doing SQL in GUI - Ctrl has Update method, so that takes preference.

Update and SqlUpdate are equivalent.

Mirek
Re: How to use Sql * Update [message #19637 is a reply to message #19632] Fri, 26 December 2008 11:32 Go to previous messageGo to next message
michael is currently offline  michael
Messages: 153
Registered: May 2007
Location: Germany
Experienced Member
But SqlSelect isn't equivalent to Select?

When i do this:

sql * Select(SqlId(sqlWhat)).From(SqlId(sqlTable)).Where(sqlWhere).OrderBy(sqlOrder);

Everthing is ok, but when i do this:

sql * SqlSelect(SqlId(sqlWhat)).From(SqlId(sqlTable)).Where(sqlWhere).OrderBy(sqlOrder)

I get the following error:

H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2440: '<function-style-cast>' : cannot convert from 'Upp::SqlId' to 'Upp::SqlS
	elect'
        No constructor could take the source type, or constructor overload resolution was ambiguous
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2228: left of '.From' must have class/struct/union
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2228: left of '.Where' must have class/struct/union
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2228: left of '.OrderBy' must have class/struct/union
prohibisZA: 1 file(s) built in (0:01.96), 1966 msecs / file, duration = 1997 msecs, parallelization 0%

There were errors. (0:02.63)
Re: How to use Sql * Update [message #19792 is a reply to message #19637] Wed, 21 January 2009 14:07 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
michael wrote on Fri, 26 December 2008 05:32

But SqlSelect isn't equivalent to Select?

When i do this:

sql * Select(SqlId(sqlWhat)).From(SqlId(sqlTable)).Where(sqlWhere).OrderBy(sqlOrder);

Everthing is ok, but when i do this:

sql * SqlSelect(SqlId(sqlWhat)).From(SqlId(sqlTable)).Where(sqlWhere).OrderBy(sqlOrder)

I get the following error:

H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2440: '<function-style-cast>' : cannot convert from 'Upp::SqlId' to 'Upp::SqlS
	elect'
        No constructor could take the source type, or constructor overload resolution was ambiguous
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2228: left of '.From' must have class/struct/union
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2228: left of '.Where' must have class/struct/union
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1069) : error C2228: left of '.OrderBy' must have class/struct/union
prohibisZA: 1 file(s) built in (0:01.96), 1966 msecs / file, duration = 1997 msecs, parallelization 0%

There were errors. (0:02.63)



Yes, but it was not intentional, rather forgotten. Now fixed.

[Updated on: Wed, 21 January 2009 14:08]

Report message to a moderator

Previous Topic: Issue with getting data back from a sqlite3 database
Next Topic: OleDB + parameters = problem
Goto Forum:
  


Current Time: Mon Apr 29 09:29:06 CEST 2024

Total time taken to generate the page: 0.03642 seconds