我正在开发一个代码,用于显示数据库中的数据:
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
str1 ="<table border=1 cellpadding=5 sortable><tr>"
For Each field In rs.Fields
str1 = str1 & "<th>" & field.Name & "</th>"
Next
str1 = str1 & "</tr>"
Do Until RS.EOF
str1 = str1 & "<tr>"
For Each field In rs.Fields
str1 = str1 & "<td>" & Round((field.Value),2) & "</td>"
Next
str1 = str1 & "<tr>"
rs.MoveNext
Loop
str1 = str1 & "</table>"
MainDisplay.InnerHTML = str1
rs.Close
Set rs = Nothing
MyConn.close
Set MyConn = Nothing
结果我得到了一张包含以下内容的表格:
wochentagrückgaben
2 107,69
3 114,97
4 4
5 93,06
6 88,35
所以,我想在星期一,星期二等单位更改单元格1,1 / 2,1 / 3,1 ..中的数字等等。
我有点像in case of str1=2, replace str1 = monday
这样的东西,但直到现在我还没找到方法。