Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2004, 01:29 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Type mismatch

I have a problem with type mismatch

with

ax = 0
ax = ax + osRecordSet("production")
-------------- o ----------------

<div align="left">
<HTML>
<HEAD>
<title>Dispo Tider...</title>

<STYLE TYPE="text/css">

     BODY { font-family: verdana; background-color: white;}



     select { font-family: verdana; font-size:8pt;}

     textarea { font-family: verdana; font-size:9pt;}

     input { font-family: verdana; font-size:9pt;}

     A:link { color: black !important; text-decoration: none;}
     A:visited { color: black !important; text-decoration: none;}
     A:hover { color: 7890A0 !important; text-decoration: none;}

</STYLE>
</HEAD>

<BODY>


<%

Fra_Dato = TRIM( Request( "Fra_Dato" ) )
Til_Dato = TRIM( Request( "Til_Dato" ) )
Recept = TRIM( Request( "Recept" ) )
Fabrik = TRIM( Request( "Fabrik" ) )


Function CurrentDate

    CurrentDate = DatePart("yyyy", Date) & "."

    IF DatePart("m", Date) < 10 THEN
    CurrentDate = CurrentDate & "0" & DatePart("m", Date) & "."
    ELSE
    CurrentDate = CurrentDate & DatePart("m", Date) & "."
    END IF

    IF DatePart("d", Date) < 10 THEN
    CurrentDate = CurrentDate & "0" & DatePart("d", Date)
    ELSE
    CurrentDate = CurrentDate & DatePart("d", Date)
    END IF

End Function

Function clock(timer)
    clock = ((timer \ 60) \ 60 )
End Function

    IF Recept = "" THEN
    Recept = CurrentDate
    END IF

    Servernavn = Fabrik

    IF Fabrik = "60" OR Fabrik = "62" OR Fabrik = "63" OR Fabrik = "64" OR Fabrik = "65" THEN
      Servernavn = "REX-SJL"
    END IF

    IF Fabrik = "66" OR Fabrik = "67" OR Fabrik = "69" OR Fabrik = "71" THEN
      Servernavn = "REX-AAL"
    END IF

    IF Fabrik = "75" OR Fabrik = "76" OR Fabrik = "77" OR Fabrik = "78" THEN
      Servernavn = "REX-AAL"
    END IF

    IF Fabrik = "81" OR Fabrik = "84" OR Fabrik = "86" OR Fabrik = "87" OR Fabrik = "88" THEN
      Servernavn = "REX-KLD"
    END IF

    IF Fabrik = "92" OR Fabrik = "93" THEN
      Servernavn = "REX-KLD"
    END IF

    strConnect = "Provider=MSDAORA;Data Source=" & Servernavn & ";User ID=conrmxsap;Password=ivu;"

    Set OraDatabase = Server.CreateObject("ADODB.Connection")


    OraDatabase.Open strConnect


      sqlstring = "select b.nummer as siteno, a.nummer orderno, a.unteraftnummer suborderno, t.tournummer tourno, " &_
                      "a.soll_datum orderdate, ((a.soll_startzeit/60)/60) as ordre_start, ((tp0.startzeit_soll/60)/60) as planned_production, " &_
                      "(tp0.startzeit * 1) as production, " &_
                      "tp0.ABFAHRTZEIT_soll d_plant, tp0.abfahrtzeit etd_plant, " &_
                      "tp1.startzeit_soll eta_buildingsite, tp1.startzeit a_buildingsite, " &_
                    "tp1.abfahrtzeit_soll etd_buildingsite, tp1.abfahrtzeit d_buildingsite, " &_
                    "tp2.ankunftzeit_soll eta_Plant, tp2.ankunftzeit a_plant " &_
                    "from aft a, kunde k, tpos tp0, tpos tp1, tpos tp2, tour t, entladestelle e, Baustelle b " &_
                    "where tp0.tour_id=t.id " &_
                    "and tp0.positionsnummer = 0 " &_
                    "and tp2.tour_id=t.id " &_
                    "and tp2.positionsnummer=2 " &_
                    "and tp1.positionsnummer = 1 " &_
                    "and t.id=tp1.tour_id " &_
                    "and tp1.aft_id=a.id " &_
                    "and a.kunde_id=k.id " &_
                    "and a.nummer >= 0 " &_
                    "and a.nummer <= 1000000 " &_
                    "and a.entladestelle_id=e.id " &_
                    "and e.baustelle_id=b.id " &_
                    "and b.nummer = 122222 " &_
                    "and a.soll_datum = '" & recept & "' " &_
                    "order by a.nummer,a.unteraftnummer, t.tournummer"


      Set osRecordSet = OraDatabase.Execute( sqlstring )


        %>

        <BODY text="#000000" >
        <table width="700" bgcolor="white" border=1 cellpadding=0 cellspacing=0>
        <tr>
            <th width="50">siteno.</th>
            <th width="50">production</th>

        </tr>

        <%
        WHILE NOT osRecordSet.EOF
        %>

            <tr>
                <td width="50"><%=osRecordSet("siteno")%></td>
                <td width="50"><%=osRecordSet("production")%></td>
            </tr>

        <%

        ax = 0
        ax = ax + osRecordSet("production")

        osRecordSet.MoveNext

        WEND


      osRecordSet.Close
      OraDatabase.Close
%>

</TABLE>

</BODY>
</HTML></div id="left">

 
Old April 29th, 2004, 01:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Good to see your code, but bad not knowing the Line which throws the error for you;)

Which line number does it happen?

-Vijay G
 
Old July 29th, 2004, 11:47 AM
Registered User
 
Join Date: Apr 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by happygv
 Good to see your code, but bad not knowing the Line which throws the error for you;)

Which line number does it happen?

-Vijay G
it's these lines

ax = 0
ax = ax + osRecordSet("production")
-------------- o ----------------

 
Old July 29th, 2004, 12:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

What data type is the field "production"? Does "production" have allow null capabilities?

Brian
 
Old July 29th, 2004, 08:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

I think bmains is right, try

if not isnull(osRecordSet("production")) then ax = ax + osRecordSet("production")

By the way, why do you reset ax to 0 and then add production.
If ax is meant to be accumulative, you are resetting it on every loop which wont work



======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old July 31st, 2004, 07:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi per.holleufer,
If that is supposed to hold numeric values, I would just add to rodmcleay's code as below.

if not isnull(osRecordSet("production")) then ax = CInt(ax) + CInt(osRecordSet("production"))

Yes I too wonder, why you would have to reset that within the LOOP?
ax = 0
Also I don't see this "ax" being used anywhere after the While loop, so the question arises, is it really needed to have that code there?

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
type mismatch frresh Pro Visual Basic 2005 1 April 11th, 2006 08:35 AM
Type Mismatch Anup Gavate VB How-To 4 March 28th, 2005 01:48 PM
Type mismatch NoBullMan Classic ASP Basics 2 November 16th, 2004 03:16 AM
Type mismatch sporkman43 Classic ASP Basics 4 August 14th, 2003 03:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.