Error with FormatNumber sentence

Discussion in 'ASP General' started by Lakrom, Dec 16, 2004.

  1. Lakrom

    Lakrom Guest

    Hi to all
    this is a Data Base in SQL Server 2000 in page cartola.asp
    Good previously it asks for the date format where I only want the month in a
    consultation SQL and the solution is this: f=month(date) Seth
    xRs=pCon.Execute("SELECT sum(monto_abono) ace TPtosM FROM abono_gte WHERE
    rutgte='"&session("rut")&"' AND month(fecha)="&f&"") but I have this
    consultation in the following function:
    Function TotalPuntosMes()
    '// Back all point in month on curse
    f= month(date)
    Set pCon=server.CreateObject("adodb.connection")
    pCon.Open application("StrConRuta")
    Set xRs=pCon.Execute("SELECT sum(monto_abono) as TPtosM FROM abono_gte
    WHERE rutgte='"&session("rut")&"' AND month(fecha)="&f&"")
    If not xRs.Eof then
    TotalPuntosMes=FormatNumber(xRs("TPtosM"),0,,,-2)
    End if
    pCon.Close
    SET Pcon=Nothing
    End Function
    But this it throws the error to me of do not agree the types with
    FormatNumber(), first think that the error is so that the field
    xRs("TPtosM") null or empty can have value, but it is not the case. it is
    not happened to me that it can be. I thank for of heart an aid. Thanks.

    --
    Marco Antonio Artus S.
    Lakromsoft INC.
    09-9594663
     
    Lakrom, Dec 16, 2004
    #1
    1. Advertising

  2. What is the value of xRs("TPtosM")? Can you response.write it out so you
    can see? It's hard to tell why FormatNumber is failing without knowing what
    exactly you're trying for format.

    Ray at work

    "Lakrom" <> wrote in message
    news:0Hiwd.1338$...
    > Hi to all
    > this is a Data Base in SQL Server 2000 in page cartola.asp
    > Good previously it asks for the date format where I only want the month in

    a
    > consultation SQL and the solution is this: f=month(date) Seth
    > xRs=pCon.Execute("SELECT sum(monto_abono) ace TPtosM FROM abono_gte WHERE
    > rutgte='"&session("rut")&"' AND month(fecha)="&f&"") but I have this
    > consultation in the following function:
    > Function TotalPuntosMes()
    > '// Back all point in month on curse
    > f= month(date)
    > Set pCon=server.CreateObject("adodb.connection")
    > pCon.Open application("StrConRuta")
    > Set xRs=pCon.Execute("SELECT sum(monto_abono) as TPtosM FROM abono_gte
    > WHERE rutgte='"&session("rut")&"' AND month(fecha)="&f&"")
    > If not xRs.Eof then
    > TotalPuntosMes=FormatNumber(xRs("TPtosM"),0,,,-2)
    > End if
    > pCon.Close
    > SET Pcon=Nothing
    > End Function
    > But this it throws the error to me of do not agree the types with
    > FormatNumber(), first think that the error is so that the field
    > xRs("TPtosM") null or empty can have value, but it is not the case. it is
    > not happened to me that it can be. I thank for of heart an aid. Thanks.
    >
    > --
    > Marco Antonio Artus S.
    > Lakromsoft INC.
    > 09-9594663
    >
    >
     
    Ray Costanzo [MVP], Dec 16, 2004
    #2
    1. Advertising

  3. Lakrom

    Lakrom Guest

    haw to do this: value of xRs("TPtosM")? with response.write

    "Lakrom" <> escribió en el mensaje
    news:0Hiwd.1338$...
    > Hi to all
    > this is a Data Base in SQL Server 2000 in page cartola.asp
    > Good previously it asks for the date format where I only want the month in

    a
    > consultation SQL and the solution is this: f=month(date) Seth
    > xRs=pCon.Execute("SELECT sum(monto_abono) ace TPtosM FROM abono_gte WHERE
    > rutgte='"&session("rut")&"' AND month(fecha)="&f&"") but I have this
    > consultation in the following function:
    > Function TotalPuntosMes()
    > '// Back all point in month on curse
    > f= month(date)
    > Set pCon=server.CreateObject("adodb.connection")
    > pCon.Open application("StrConRuta")
    > Set xRs=pCon.Execute("SELECT sum(monto_abono) as TPtosM FROM abono_gte
    > WHERE rutgte='"&session("rut")&"' AND month(fecha)="&f&"")
    > If not xRs.Eof then
    > TotalPuntosMes=FormatNumber(xRs("TPtosM"),0,,,-2)
    > End if
    > pCon.Close
    > SET Pcon=Nothing
    > End Function
    > But this it throws the error to me of do not agree the types with
    > FormatNumber(), first think that the error is so that the field
    > xRs("TPtosM") null or empty can have value, but it is not the case. it is
    > not happened to me that it can be. I thank for of heart an aid. Thanks.
    >
    > --
    > Marco Antonio Artus S.
    > Lakromsoft INC.
    > 09-9594663
    >
    >
     
    Lakrom, Dec 16, 2004
    #3
  4. <%
    Response.WRite "The value is " & xRs("TPtosM")
    %>

    Ray at work

    "Lakrom" <> wrote in message
    news:uBjwd.1355$...
    > haw to do this: value of xRs("TPtosM")? with response.write
    >
    > "Lakrom" <> escribió en el mensaje
    > news:0Hiwd.1338$...
    > > Hi to all
    > > this is a Data Base in SQL Server 2000 in page cartola.asp
    > > Good previously it asks for the date format where I only want the month

    in
    > a
    > > consultation SQL and the solution is this: f=month(date) Seth
    > > xRs=pCon.Execute("SELECT sum(monto_abono) ace TPtosM FROM abono_gte

    WHERE
    > > rutgte='"&session("rut")&"' AND month(fecha)="&f&"") but I have this
    > > consultation in the following function:
    > > Function TotalPuntosMes()
    > > '// Back all point in month on curse
    > > f= month(date)
    > > Set pCon=server.CreateObject("adodb.connection")
    > > pCon.Open application("StrConRuta")
    > > Set xRs=pCon.Execute("SELECT sum(monto_abono) as TPtosM FROM abono_gte
    > > WHERE rutgte='"&session("rut")&"' AND month(fecha)="&f&"")
    > > If not xRs.Eof then
    > > TotalPuntosMes=FormatNumber(xRs("TPtosM"),0,,,-2)
    > > End if
    > > pCon.Close
    > > SET Pcon=Nothing
    > > End Function
    > > But this it throws the error to me of do not agree the types with
    > > FormatNumber(), first think that the error is so that the field
    > > xRs("TPtosM") null or empty can have value, but it is not the case. it

    is
    > > not happened to me that it can be. I thank for of heart an aid. Thanks.
    > >
    > > --
    > > Marco Antonio Artus S.
    > > Lakromsoft INC.
    > > 09-9594663
    > >
    > >

    >
    >
     
    Ray Costanzo [MVP], Dec 16, 2004
    #4
  5. Lakrom

    Lakrom Guest

    Thanks
    i solv the problem this:
    Function TotalPuntosMes()
    '// Devuelve los puntos del mes en curso
    f= month(date)
    Set pCon=server.CreateObject("adodb.connection")
    pCon.Open application("StrConRuta")
    Set xRs=pCon.Execute("SELECT sum(monto_abono)as TPtosM FROM abono_gte WHERE
    rutgte='"&session("rut")&"' AND month(fecha)="&f&"")
    If not xRs.Eof then
    TotalPuntosMes=FormatNumber(xRs("TPtosM"),0,,,-2)
    else
    TotalPuntosMes=FormatNumber(0,0,,,-2)
    End if
    pCon.Close
    SET Pcon=Nothing
    End Function
    the problem is come when the variable take the the value null. that is all.

    "Gracias a mi compañero Marcelo Moran que me abrio los ojos"
    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> escribió en
    el mensaje news:...
    > <%
    > Response.WRite "The value is " & xRs("TPtosM")
    > %>
    >
    > Ray at work
    >
    > "Lakrom" <> wrote in message
    > news:uBjwd.1355$...
    > > haw to do this: value of xRs("TPtosM")? with response.write
    > >
    > > "Lakrom" <> escribió en el mensaje
    > > news:0Hiwd.1338$...
    > > > Hi to all
    > > > this is a Data Base in SQL Server 2000 in page cartola.asp
    > > > Good previously it asks for the date format where I only want the

    month
    > in
    > > a
    > > > consultation SQL and the solution is this: f=month(date) Seth
    > > > xRs=pCon.Execute("SELECT sum(monto_abono) ace TPtosM FROM abono_gte

    > WHERE
    > > > rutgte='"&session("rut")&"' AND month(fecha)="&f&"") but I have this
    > > > consultation in the following function:
    > > > Function TotalPuntosMes()
    > > > '// Back all point in month on curse
    > > > f= month(date)
    > > > Set pCon=server.CreateObject("adodb.connection")
    > > > pCon.Open application("StrConRuta")
    > > > Set xRs=pCon.Execute("SELECT sum(monto_abono) as TPtosM FROM

    abono_gte
    > > > WHERE rutgte='"&session("rut")&"' AND month(fecha)="&f&"")
    > > > If not xRs.Eof then
    > > > TotalPuntosMes=FormatNumber(xRs("TPtosM"),0,,,-2)
    > > > End if
    > > > pCon.Close
    > > > SET Pcon=Nothing
    > > > End Function
    > > > But this it throws the error to me of do not agree the types with
    > > > FormatNumber(), first think that the error is so that the field
    > > > xRs("TPtosM") null or empty can have value, but it is not the case. it

    > is
    > > > not happened to me that it can be. I thank for of heart an aid.

    Thanks.
    > > >
    > > > --
    > > > Marco Antonio Artus S.
    > > > Lakromsoft INC.
    > > > 09-9594663
    > > >
    > > >

    > >
    > >

    >
    >
     
    Lakrom, Dec 16, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jluis
    Replies:
    3
    Views:
    725
    Riyaz
    May 5, 2004
  2. Geo
    Replies:
    0
    Views:
    483
  3. eddie wang

    formatnumber function returns error

    eddie wang, Feb 10, 2004, in forum: ASP General
    Replies:
    11
    Views:
    535
    Bob Barrows [MVP]
    Feb 11, 2004
  4. MiniEggs

    FormatNumber

    MiniEggs, Dec 4, 2009, in forum: ASP General
    Replies:
    4
    Views:
    945
    Bob Barrows
    Dec 4, 2009
  5. Greg
    Replies:
    3
    Views:
    155
    Dr John Stockton
    Sep 14, 2003
Loading...

Share This Page