| 
 | 
 | 
 
Home » U++ Library support » U++ SQL » Convert String to SqlId 
	
		
		
			| Convert String to SqlId [message #19619] | 
			Tue, 23 December 2008 16:22   | 
		 
		
			
				
				
				  | 
					
						  
						michael
						 Messages: 153 Registered: May 2007  Location: Germany
						
					 | 
					Experienced Member  | 
					 | 
		 
		 
	 | 
 
	
		I'm using the following code to query my database: 
 
SqlId count("COUNT(*)");
sql * Select(count).From(sqlTable).Where(PRODUKT=="prohibis"); 
 
sqlTable is a String. How do i use these String as a SqlId? I get the following errors when compiling: 
 
G:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1048) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 
	'Upp::SqlVal' (or there is no acceptable conversion)
        C:\upp\uppsrc\Core/String.h(297): could be 'Upp::String &Upp::String::operator =(const char *)'
        C:\upp\uppsrc\Core/String.h(298): or       'Upp::String &Upp::String::operator =(const Upp::String &)'
        C:\upp\uppsrc\Core/String.h(299): or       'Upp::String &Upp::String::operator =(Upp::StringBuffer &)'
        while trying to match the argument list '(Upp::String, Upp::SqlVal)'
G:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1052) : error C2668: 'Upp::SqlSelect::From' : ambiguous call to overloaded function
        c:\upp\uppsrc\sql\Sqlexp.h(454): could be 'Upp::SqlSelect &Upp::SqlSelect::From(const Upp::SqlVal &)'
        c:\upp\uppsrc\sql\Sqlexp.h(451): or       'Upp::SqlSelect &Upp::SqlSelect::From(Upp::SqlId)'
        while trying to match the argument list '(Upp::String)'
G:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1052) : error C2228: left of '.Where' must have class/struct/union
prohibisZA: 1 file(s) built in (0:02.01), 2016 msecs / file, duration = 2047 msecs, parallelization 0%
 
 
I get no errors when i replace the String sqlTable with the SqlId KUNDEN which i defined in the schema-file: 
 
sql * Select(count).From(KUNDEN).Where(PRODUKT=="prohibis");  
 
How can i convert my String sqlTable into a SqlId? 
 
		
		
		[Updated on: Tue, 23 December 2008 16:52] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	
		
		
			| Re: Convert String to SqlId [message #19621 is a reply to message #19619] | 
			Tue, 23 December 2008 19:12    | 
		 
		
			
				
				
				  | 
					
						  
						michael
						 Messages: 153 Registered: May 2007  Location: Germany
						
					 | 
					Experienced Member  | 
					 | 
		 
		 
	 | 
 
	
		ok, that's a replacement for my count-method, but the main-problem is how to use a String (sqlTable) as SqlId: 
 
Sql sql(session);
SqlId all("*");
sql * Select(SqlCountRows()).From(sqlTable).Where(PRODUKT=="prohibis");
 
 
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1049) : error C2668: 'Upp::SqlSelect::From' : ambiguous call to overloaded function
        c:\upp\uppsrc\sql\Sqlexp.h(454): could be 'Upp::SqlSelect &Upp::SqlSelect::From(const Upp::SqlVal &)'
        c:\upp\uppsrc\sql\Sqlexp.h(451): or       'Upp::SqlSelect &Upp::SqlSelect::From(Upp::SqlId)'
        while trying to match the argument list '(Upp::String)'
H:\Entwicklung\UPP\prohibisZA\prohibisZA.cpp(1049) : error C2228: left of '.Where' must have class/struct/union
prohibisZA: 1 file(s) built in (0:03.63), 3635 msecs / file, duration = 3697 msecs, parallelization 0%
There were errors. (0:04.68) 
		
		
		[Updated on: Tue, 23 December 2008 19:17] Report message to a moderator  
 |  
	| 
		
	 | 
 
 
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |  
	| 
		
 |   
Goto Forum:
 
 Current Time: Tue Nov 04 08:55:20 CET 2025 
 Total time taken to generate the page: 0.08604 seconds 
 |   
 |  
  |