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 » SqlVal to int (Typecast) (Typecasting from sqlval type to other types)
Re: SqlVal to int (Typecast) [message #45175 is a reply to message #45174] Wed, 23 September 2015 06:58 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi ayana,

ayana wrote on Wed, 23 September 2015 06:25
SqlVal ro;
Sql UserQuerySql;
UserQuerySql.Clear();
UserQuerySql * Select (Count(MBVARINDEX)).From ( PARAMETER );
while ( UserQuerySql.Fetch() )
{
ro=Count(MBVARINDEX);
}

In the above query whatever the count value I am getting is of type 'SqlVal',I want that to typecast into 'Int', Let me know how to do typecasting for it.

This SqlVal is actually only representation of sql column used when constructing the query. What you need is the result, which is accesible via the Sql object after calling Fetch:
int ro;
Sql UserQuerySql;
UserQuerySql.Clear();
UserQuerySql * Select (Count(MBVARINDEX)).From ( PARAMETER );
while ( UserQuerySql.Fetch() )
{
  ro=sql[0];
}

See the Sql tutorial, it demonstrates this and many other useful and important thing about sql in U++.

Best regards,
Honza
 
Read Message
Read Message
Read Message icon7.gif
Read Message
Read Message
Read Message
Previous Topic: Help: GetSysTime()
Next Topic: Usage of Iml image data leads to linker error
Goto Forum:
  


Current Time: Tue May 14 09:21:36 CEST 2024

Total time taken to generate the page: 0.03364 seconds