locked
Runtime-Error in Microsoft VBScript Error "800a000d' Classic ASP RRS feed

  • Question

  • User353911562 posted

    Hi,

    I used the same Code connecting to an access-database. I changed the connection to a mysql-database and got the following error:

    Runtime-Error in Microsoft VBScript Error "800a000d'

    Data Type Conflict

    /fpuBuchungen.asp, Zeile 27

    This is the Code:

    ---------------------

    Function CheckNummer(intNummer)
        If IsNull(intNummer) Then
            Checknummer = False
        Else
            Call OpenDBMain()
            Dim objCnt, strSQL
            strSQL = "SELECT Count(Personal.ID) AS Anzahl FROM Personal WHERE Personal.PersonalNr=" & intNummer
            Set objCnt = Server.CreateObject("ADODB.Recordset")
            objCnt.Open strSQL, objConn, 1, 3
            If objCnt("Anzahl") = 1 Then    Here the Error occurs...

    i checked the datatypes in the Access-Database and in the MySQL-database and they seem to be Ok...

    Saturday, July 4, 2015 12:35 PM

All replies

  • User-1122936508 posted

    objCnt("Anzahl")

    This is obviously not the datatype you think it is. WScript has a VarType() function you can call to get the type:

    Response.Write(VarType(objCnt("Anzahl").Fields(0).Value)))

    Sunday, July 5, 2015 8:14 PM
  • User353911562 posted

    Hi Ken,

    Good idea:-) But i get the following error now:

    Das Objekt unterstützt diese Eigenschaft oder Methode nicht.: 'objCnt(...).Fields'

    what meens

    object does not support this property or method 'objCnt(...).Fields'

    i put it in here:

     Dim objCnt, strSQL
            strSQL = "SELECT Count(Personal.ID) AS Anzahl FROM Personal WHERE Personal.PersonalNr=" & intNummer
            Set objCnt = Server.CreateObject("ADODB.Recordset")
            objCnt.Open strSQL, objConn, 1, 3
            Response.Write(VarType(objCnt("Anzahl").Fields(0).Value))
            If objCnt("Anzahl") = 1 Then

    Monday, July 6, 2015 10:45 AM
  • User-1122936508 posted

    Odd, as a Recordset definitely has a Fields collection:

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms676603(v=vs.85).aspx

    Can you try:

     objCnt.Open strSQL, objConn, 1, 3

    If objCnt.EOF and objCnt.BOF then

       Response.Write ("No Records Returned")

       Response.End

    End If

    Tuesday, July 7, 2015 12:41 AM
  • User353911562 posted

    Hi Ken,

    I know:-) Used it with dao frequently....so im wondering why it gives an error here...exept the would be no returnvalue:-)

    So after insertting your code, there is no output what meens, there is a record. I see the value with rsponse.write (intNummer), retvalue is 1015...1 Record

    About this typ-missmatch: The value which shows has datatype int(4) in the database...

    Any more ideas??

    Peter

    Tuesday, July 7, 2015 9:50 AM
  • User-1122936508 posted

    About this typ-missmatch: The value which shows has datatype int(4) in the database...

    Not applicable - it's the datatype in WScript that's important..

    I wonder if we can do the following:

    If objCNT.EOF and objCNT.BOF then

       Response.WRite("no records")

       Response.End

    Else

    Do While Not objCnt.EOF

       For Each oField in objCnt.Fields

         Response.Write oField.Name & " = " & oField.Value & "<br />"

      Next

      objCnt.movenext

    Loop

    End If

    Apologies if there's some syntax errors in my code - typing it directly into the browser here.

    Wednesday, July 8, 2015 11:43 PM
  • User353911562 posted

    OK, i did it like this. The responds.write generates "Anzahl = 1 as output'

    Correct so far.....

    --------------------------------------

    Function PruefeNummer(intNummer)
        'Response.Write(len(intNummer))'
        If IsNull(intNummer) Then
            PruefeNummer = False
        Else
            Call OpenDBMain()
            Dim objCnt, strSQL
            strSQL = "SELECT Count(Personal.ID) AS Anzahl FROM Personal WHERE Personal.PersonalNr=" & intNummer
            Set objCnt = Server.CreateObject("ADODB.Recordset")
            objCnt.Open strSQL, objConn, 1, 3

            If objCNT.EOF and objCNT.BOF then
                   Response.Write("no records")
                   Response.End
            Else
                Do While Not objCnt.EOF
                   For Each oField in objCnt.Fields
                    Response.Write oField.Name & " = " & oField.Value & "<br />"
                  Next
              objCnt.movenext
            Loop

            End If

    Friday, July 10, 2015 10:40 AM
  • User353911562 posted

    OK, i tried something else:

    Code passed now the first error (see mark), but then it stopped with an odbc-error at the last line:ODBC-Driver does not support this property... but it did acceppt the same code at line 11.....seems strange to me...

    Function PruefeNummer(intNummer)
        If IsNull(intNummer) Then
            PruefeNummer = False
        Else
            Call OpenDBMain()
            Dim objCnt, strSQL
            strSQL = "SELECT Count(Personal.ID) AS Anzahl " & _
                "FROM Personal " & _
                "WHERE Personal.PersonalNr=" & intNummer
            Set objCnt = Server.CreateObject("ADODB.Recordset")
            objCnt.Open strSQL, objConn, 1, 3
            'If objCnt("Anzahl") = 1 Then
            If intNummer > 1 then
                PruefeNummer = True
                Session("PersonalNr") = intNummer
                'Jetzt den Personalnamen zwischenspeichern
                strSQL = "SELECT Personal.PersonalNr, Personal.PName " & _
                    "FROM Personal " & _
                    "WHERE Personal.PersonalNr=" & intNummer
                Set objRS = Server.CreateObject("ADODB.Recordset")
                objRS.Open strSQL, objConn, 1, 3
                    Session("PName")= objRS("PName")
                objRS.Close
                Set objRS = Nothing
                strSQL = "SELECT Last(KENNZ) AS LKENNZ, Last(ZEITPUNKT) AS LZeitpunkt, " & _
                    "Last(Kostenstelle) AS LKostenstelle, Last(ProjektNr) AS LProjektNr, " & _
                    "Last(Zeitart) AS LZeitart, Last (Erstellt_am) AS LErstelltAm " & _
                    "FROM Buchungen GROUP BY PERSNR HAVING PERSNR = " & intNummer & _
                    " ORDER BY PERSNR, Last(ID)"
                Set objStatus = Server.CreateObject("ADODB.Recordset")
                objStatus.Open strSQL, objConn, 1, 3

    Friday, July 10, 2015 12:01 PM