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 » Community » Newbie corner » [SOLVED] Converting from 'Upp::Value' to 'char'
[SOLVED] Converting from 'Upp::Value' to 'char' [message #47551] Fri, 27 January 2017 08:59 Go to next message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi there,
I have to call a method passing some parameters I got from a DB:
_macroLav.SetMLav(SQL[STATUS], SQL[SUBSTATUS], SQL[START_TIME]);


The STATUS in the db is a VARCHAR(1) field; in the schema file .sch is defined as follows:
STRING_ (STATUS, 1)


When I try to compile I got the following error:
error C2664: 'void MLav::SetMLav(char,char,Upp::Time)': cannot convert parameter number 1 from 'Upp::Value' to 'char'


I came up with this awful solution:
String s1 = SQL[STATUS];
char c1 = s1[0];
_macroLav.SetMLav(c1, SQL[SUBSTATUS], SQL[START_TIME]);


Is there a smarter way to convert from Upp::Value to char?

Thanks,
Gio

[Updated on: Thu, 02 February 2017 15:49]

Report message to a moderator

Re: Converting from 'Upp::Value' to 'char' [message #47563 is a reply to message #47551] Sat, 28 January 2017 22:13 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 325
Registered: July 2009
Senior Member
You can convert Value to String and take one char on the fly SQL[STATUS].ToString()[0]

macroLav.SetMLav(c1, (char)(SQL[STATUS].ToString()[0]), SQL[START_TIME]);

[Updated on: Sat, 28 January 2017 22:14]

Report message to a moderator

Re: Converting from 'Upp::Value' to 'char' [message #47587 is a reply to message #47563] Thu, 02 February 2017 15:48 Go to previous message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Thanks!
Previous Topic: [SOLVED] Logging and LOG_APPEND
Next Topic: [SOLVED] Showing elapsed time
Goto Forum:
  


Current Time: Thu Mar 28 14:32:13 CET 2024

Total time taken to generate the page: 0.01367 seconds