100分求解 asp中表示式中getdate函式未定

時間 2022-04-28 03:06:28

1樓:匿名使用者

1。看你資料庫連線中用jet,你的是access是吧?access沒有getdate()函式。用的是now()函式。

2。而用了now後產生的「至少乙個引數沒有被指定值」是因為可能有其他錯誤。

你的**寫得有些亂,重複的地方多,除錯起來不太容易。

如下,不過有些**我用...代替了。你自己替換一下。然後看一下sql輸出的是什麼值。這樣再在access中去執行一下。

sql = ""

sql = sql & "select top " & (page * maxperpage) & " adid, city_oneid, city_twoid, city_threeid, city_one, city_two, city_three," & vbcrlf

sql = sql & " type_oneid, type_twoid, type_threeid," & vbcrlf

sql = sql & " [color], [title], [text], [date], pic, hits, [money], moneydate, [top], [hot]" & vbcrlf

sql = sql & "from china_data" & vbcrlf

sql = sql & "where (mark = 'yes'" & vbcrlf

if (....) then

sql = sql & "and (" & vbcrlf

sql = sql & " (datediff(d, now(), [stop]) >= 1)" & vbcrlf

sql = sql & " or (" & vbcrlf

sql = sql & " ([money] > 0)" & vbcrlf

sql = sql & " and (datediff(d, now(), [moneydate]) >= 1)" & vbcrlf

sql = sql & " )" & vbcrlf

sql = sql & ")" & vbcrlf

else

sql = sql & "and (" & vbcrlf

sql = sql & " [stop] >= date()" & vbcrlf

sql = sql & " or (" & vbcrlf

sql = sql & " [money] > 0" & vbcrlf

sql = sql & " and moneydate >= date()" & vbcrlf

sql = sql & " )" & vbcrlf

sql = sql & ")" & vbcrlf

end if

sql = sql & c & t & vbcrlf

sql = sql & " order by [top] desc"

select case ordertype

case 1

sql = sql & ", adid"

case 2

sql = sql & ", adid desc"

case 3

sql = sql & ", hits"

case 4

sql = sql & ", hits desc"

case else

sql = sql & ", [money] desc,adid desc"

end select

if (not isobject(conn) or conn is nothing) then dblink

set rs = server.createobject("adodb.recordset")

rs.open sql,conn,1,1

if not rs.eof then rs.move (maxperpage * (page - 1))

if not rs.eof then typedata = rs.getrows

...rs.close

set rs = nothing

2樓:

你沒有在函式datediff(d,now(),[moneydate])中加單引號,注意加上單引號,datediff('d',now(),[moneydate])表明 是按照日期'd'進行計算時間間隔的。

''注意:在 access中,函式datediff('d',now(),[moneydate])中第乙個引數要加上單引號,否則會發生 至少乙個引數沒有被指定值。在sql server中函式datediff('d',now(),[moneydate])第乙個引數不需要加單引號的。

這是 兩個型別的sql語句中的區別。

你的資料庫應該是access資料庫,把getdate()換成 now(),

現把**修改如下。執行無誤。

>=1 or (datediff('d',now(),[moneydate])>=1 and [money]>

else

>=date() or ([money]>0 and moneydate>

end if

select case ordertype

case 1

sql = sql & ",adid"

case 2

sql = sql & ",adid desc"

case 3

sql = sql & ",hits"

case 4

sql = sql & ",hits desc"

case else

sql = sql & ",[money] desc,adid desc"

end select

if not isobject(conn) or conn is nothing then dblink

set rs=server.createobject("adodb.recordset")

rs.open sql,conn,1,1

if not rs.eof then rs.move (maxperpage*(page-1))

if not rs.eof then typedata=rs.getrows

3樓:匿名使用者

>=1 or (datediff(d,getdate(),[moneydate])>=1 and [money]>

至少乙個引數沒有被指定值!

錯誤一定在sql這個變數裡面!

將以下**放到「select case ordertype」前面試試:

response.write sql

response.end

看一下輸出的語句,你就知道哪有問題

高分求助,高手請進 表示式中 'getdate' 函式未定義

4樓:

第一段的 sql 語句貼全一點來看看

第二段的, datestr 把這個的賦值的那一段貼出來

5樓:匿名使用者

呃~好難..沒選這個方向是正確的!

asp中sql語句問題 50分

改為 不過建議會like 出現以上的錯誤是由於你的ziduan變數中沒有取到值引起的,你可以列印出ziduan變數的值,看看是不是沒有值,注意,你的ziduan變數中的值必須要在表的有相應的字段才可以,要不也會報錯的 建議資料庫和表起英文名.還有這句 sql select from aa where...

高分求解幾個問題100分

首先8800gts 是較早開發的產品,對應的是高階市場。其成本較大,良品率低,加之麗台是個老品牌,其顯示卡用料豪華,做工優秀,於是價錢稍高。hd3850和8800gts不是乙個公司的產品了,效能不能用流處理器數量來衡量。3850對應的市場比8800gts低半個檔次,開發也比較晚。55nm的製程可以在...

高分求解電腦宕機問題!追加100分

1。先說軟體 有條件的話找個u盤把你硬碟裡自己重要的檔案拷過去。然後把硬碟格了重新分割槽,然後裝個系統。2.重灌系統還不行的話,就是你的硬體出問題了。你把你的記憶體和顯示卡 獨立 拔下來你橡皮把金手指擦一下。再插上要是問題還沒解決,就開始懷疑你硬體有問題了。有條件的話再找點硬體把你的換下來試試。第一...

100分求解答 懂法律的朋友請進

這種情況,需要查明電腦損壞的原因。只要查明電腦損壞不是你們公司造成的,就不需要承擔責任。你先到4s店 知道那個到底損壞的原因是什麼 老化還是什麼對吧而且很關鍵一點 你的汽車美容店 美容的地方是 有沒有包括那個變速器電腦 如果你只是對車外表 進行了 美容或者 清洗 根本接觸不到他所說的那個東西 他就是...

急。。求。急。。求。。急100分求解答

不知道lz的兩個囊腫是不是蛛網膜囊腫?有ct 的話相機拍了附上來,幫你參謀一下。另外樓主說的血管在跳是屬於血管性波動性,是由於腦血管痙攣導致的,服用尼莫地平20mg 3 日緩解。但是什麼原因引起來的還是要查清楚,囊腫壓迫也可能引起,還有樓主到底有沒有高血壓?平時脖子有沒有不舒服?樓主的職業是什麼?治...