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 #45225 is a reply to message #45224] Sat, 10 October 2015 06:57 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
Alboni wrote on Sat, 10 October 2015 01:01
Hi, I'm using the same code for MySql and SqLite versions of my program and I'd like to point out that using
ro=sql[0];
can behave rather quirky.. in combination with functions like Sum() or Count()
Depending of which db you use, Count, Sum etc. could be presented as int or a String type. Confusing.

A better way (especially if you would select more than one column) is to use the As function:
UserQuerySql * SqlSelect (SqlCount(MBVARINDEX).As(MBVARINDEX)).From ( PARAMETER );
while ( UserQuerySql.Fetch() )
{
  ro=sql[MBVARINDEX];
}

I also like to use SqlSelect, SqlSum, SqlCount etc. because the other terms are so generic there are often clashes.


Interesting. Can you be more specific about the issue, like providing example which fails? (and on what DB?)

Mirek
 
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 20:53:18 CEST 2024

Total time taken to generate the page: 0.02518 seconds