Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting access to a SUM column from the SQL
Message
 
To
13/06/2006 17:51:09
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01128850
Message ID:
01129000
Views:
20
Michel,

What if you cast/convert the sum column in your query to int:
SELECT CAST(SUM(NewAccount) AS INT) AS SumColumn FROM Monthly
or
SELECT CONVERT(INT, SUM(NewAccount)) AS SumColumn FROM Monthly
It may be that the server is creating a column of a different data type.

HTH,
Chad


>I have a situation that I am trying to resolve. If I do this:
>
>
>MessageBox.Show((25).ToString("#########0"))
>
>
>It works. But, if I do this:
>
>
>        Dim loDataProviderTotal As Framework.Framework.Data = New Framework.Framework.Data(oApp)
>        Dim loRowTotal As DataRow
>
>        If Not loDataProviderTotal.SQLExec("SELECT SUM(NewAccount) AS SumColumn FROM Monthly", oApp.aConnection(3)) Then
>            MessageBox.Show(oApp.cError + " : " + loDataProviderTotal.cSQL + " : " + loDataProviderTotal.cConnectionString)
>            Exit Sub
>        End If
>
>        loRowTotal = loDataProviderTotal.oDataView(0).Row
>        MessageBox.Show(loRowTotal("SumColumn").ToString("#########0"))
>
>
>I end up with an error:
>
>Conversion from string "#########0" to type 'Integer' is not valid.
>
>Basically, there seems to be something different in the way .NET handles a SUM column from the SQL. Anyone knows what need to be adjusted in order to apply the same formatting from the sum column?
_________________________________
There are 2 types of people in the world:
    Those who need closure
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform