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.:
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
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
- Sub OnChangeStation()
- On Error Resume Next
- SetLocale("de")
- Set MyConn = CreateObject("ADODB.Connection")
- MyConn.Open "Driver={Microsoft Visual FoxPro Driver};SourceType=DBF;SourceDB="&Datei&";Exclusive=No"
- 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"
- Set rs=CreateObject("ADODB.recordset")
- rs.Open SQL_query1, MyConn
- If Err.Number <>0 Then
- MsgBox "Sie haben kein Verzeichnis ausgewählt"
- End If
- On Error Goto 0
- Dim arrAllData
- arrAllData = rs.GetRows()
- Dim numCols 'number of fields per row in results
- Dim numColCounter 'used to loop through the columns
- Dim numRows 'number of rows in results
- Dim numRowCounter 'used to loop through the rows
- Dim strthisfield 'current field in loop
- numCols = UBound(arrAllData, 1)
- numRows = UBound(arrAllData, 2)
- Document.Write("<table border=1 cellpadding=8><tr>" & vbcrlf)
- 'loop through rows
- For numRowCounter = 0 To numRows
- Document.Write("<tr>" & vbcrlf)
- 'for each column
- For numColCounter = 0 to numCols
- strthisfield = arrAllData(numColCounter, numRowCounter)
- If IsNull(strthisfield) Then
- strthisfield = "-null-"
- End If
- If Trim(strthisfield) = "" Then
- strthisfield = " "
- End If
- Select Case strthisfield
- Case "2"
- strthisfield("2") = "Montag"
- Case Else
- End Select
- Document.Write("<td >" & Round(strthisfield) & "</td>" & vbcrlf)
- Next
- Document.Write("</tr>" & vbcrlf)
- Next
- Document.Write("</table>")
- rs.Close
- Set rs = Nothing
- MyConn.close
- Set MyConn = Nothing
- 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