GetRow Daten ändern in HTA mit VBScript

  • VBScript

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von petaod.

    GetRow Daten ändern in HTA mit VBScript

    Hallo zusammen,

    ich stehe seit Tagen vor folgendem Problem: ich lese aus einer foxpro Datenbank Daten aus, so weit so gut. Nun habe ich 2 Fleder als Ergebnis: Spalte eins sind Tage in Form von Zahlen..also 1 für Sonntag usw., Spalte 2 ist ein Mittelwert. So weit so gut, das query hab ich schon vorher beim auslesen gebildet.
    Nun zum eigentlichen Problem: Ich möchte das Spalte 1 also die Wochentage auch als Wochentage angezeigt werden. CDOW funktioniert nicht da der ODBC Treiber für Foxpro unvollständige Tagesnamen angibt..also Wednes Wednesday usw. Daher war mein Gedankengang jener, die Daten im GetRow Array einfach umzu benennen: sprich aus 1 mach Sonntag usw.:

    Quellcode

    1. Sub OnChangeStation()
    2. On Error Resume Next
    3. SetLocale("de")
    4. Set MyConn = CreateObject("ADODB.Connection")
    5. MyConn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB="&Datei&";Exclusive=No"
    6. SQL_query1 = "SELECT DOW(daaprotx.datum)as Wochentag,Count(daaprotx.datum)/COUNT(DISTINCT daaprotx.datum)As Rückgaben FROM daaprotx WHERE BETWEEN (daaprotx.datum, gomonth(date(), -12), daaprotx.datum) AND(daaprotx.prottyp='1') AND(daaprotx.station='"&Station.options(Station.selectedIndex).value&"')Group by 1"
    7. Set rs=CreateObject("ADODB.recordset")
    8. rs.Open SQL_query1, MyConn
    9. If Err.Number <>0 Then
    10. MsgBox "Sie haben kein Verzeichnis ausgewählt"
    11. End If
    12. On Error Goto 0
    13. Dim arrAllData
    14. arrAllData = rs.GetRows()
    15. Dim numCols 'number of fields per row in results
    16. Dim numColCounter 'used to loop through the columns
    17. Dim numRows 'number of rows in results
    18. Dim numRowCounter 'used to loop through the rows
    19. Dim strthisfield 'current field in loop
    20. numCols = UBound(arrAllData, 1)
    21. numRows = UBound(arrAllData, 2)
    22. Document.Write("<table border=1 cellpadding=8><tr>" & vbcrlf)
    23. 'loop through rows
    24. For numRowCounter = 0 To numRows
    25. Document.Write("<tr>" & vbcrlf)
    26. 'for each column
    27. For numColCounter = 0 to numCols
    28. strthisfield = arrAllData(numColCounter, numRowCounter)
    29. If IsNull(strthisfield) Then
    30. strthisfield = "-null-"
    31. End If
    32. If Trim(strthisfield) = "" Then
    33. strthisfield = " "
    34. End If
    35. Select Case strthisfield
    36. Case "2"
    37. strthisfield("2") = "Montag"
    38. Case Else
    39. End Select
    40. Document.Write("<td >" & Round(strthisfield) & "</td>" & vbcrlf)
    41. Next
    42. Document.Write("</tr>" & vbcrlf)
    43. Next
    44. Document.Write("</table>")
    45. rs.Close
    46. Set rs = Nothing
    47. MyConn.close
    48. Set MyConn = Nothing
    49. End Sub


    hier mal mein Code, ich habe nun schon sehr viel probiert und scheitere durchweg, bin leider auch erst ein *junger* programmierer und hab es nun auch schon mit getstring und If--EOF probiert, denke ich habe da irgendwo einen Denkfehler. Vielleicht weiss einer von euch ja wie man das schöner löst :)

    Mfg Cryings