English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

rs.Open "select * from 111bill" & _
" where buycode= '" & Txt_CusCode & "'" & _
" and str(month(buydate)) <> '" & Month(Date) & "'" & _
" and finish = false", CN, , 3
Select結果還是含本月 請問應如何改

2005-12-02 09:34:45 · 3 個解答 · 發問者 Anonymous in 電腦與網際網路 程式設計

答:
rs.Open "select * from 111bill" & _
" where buycode= '" & Txt_CusCode & "'" & _
" and str(month(buydate)) '" & Str(Month(Date)) & "'" & _
" and finish = false", CN, , 3

2005-12-02 10:01:36 · update #1

保正沒問題
rs.Open "select * from 111bill" & _
" where buycode= '" & Txt_CusCode & "'" & _
" and finish = false" & _
" and str(PutBillDate)

2005-12-02 10:51:47 · update #2

3 個解答

str(month(buydate)) 有問題...把 str 拿掉吧..基本上,出錯的原因是 string 比對 integer 看你要把 str 拿掉,或是兩邊都加上 str 隨你要我的話,拿掉原因:沒事去讓程式跑一個 str() 函數浪費一點資源幹嘛?雖然浪費的時間是以0.000......毫米來計算。但何必咧?不過,就像我之前說的,你到時候用VB時會變成輸入日期+時間而VB的日期與時間排列,在輸入ACCESS時又會有不同所以當比對日期,又會把時間給放進去,然後出現種種比對失敗...所以,換是我,我直接用 string 方式來避免這個問題的產生

2005-12-02 14:56:53 補充:
剛自己資料庫測試了一下 你加上str() 會有問題 ...

2005-12-02 09:44:15 · answer #1 · answered by Anonymous · 0 0

rs.Open "select * from 111bill" & _
" where buycode= '" & Txt_CusCode & "'" & _
" and Month(buydate) <> " & Month(Date) & _
" and finish = false", CN, , 3

2005-12-02 10:10:09 · answer #2 · answered by W.J.S. 7 · 0 0

您怎麼知道我什麼時候把問題貼上去
竟然馬上有回應 真厲害

2005-12-02 09:54:23 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers