1
我的工作会从数据库中显示数据的代码替换HTA单元中的数据:如何使用VBScript
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
5 93,06
6 88,35
所以,我想改变细胞1,1/2,1/3,1数..等在周一,周二等等。
我喜欢这样的事情:in case of str1=2, replace str1 = monday
,但我到现在还没有找到方法。
我与CDOW的问题是,再由集团通过名单将由年初sortet信件:星期五然后首先等等。我需要这个德国人的名字,所以我希望能取代最好的方式。这就是我选择这种方式的原因。孔程序要大得多,但我已经写了相关的代码。 – Crying
@Crying - 所以使用类似“SELECT CDOW()... ORDER BY DOW()” –