0
我正在使用VBScript處理傳入的文本消息。我有一個條件,如果傳入值低於數據庫中的值,則會向發送者發送一條消息。由於某些原因,即使值較高,消息集仍然正在發送。小於或等於不工作
基本上,變量arrmessage
包含一個數字,例如300,然後將其與變量val
進行比較,該變量是數據庫表中稱爲出價的最大值。因此,例如val = 10
。
當我放置arrmessage <= val then... elseif arrmessage > val then
它總是告訴我,arrmessage
低於val
,即使它更高。
Set objConn = CreateObject("ADODB.Connection")
set mycommand = CreateObject("ADODB.COMMAND")
objConn.Open "Provider=SQLOLEDB.1;Data Source=OFFICE-PC\SQLEXPRESS Initial Catalog=SMSSERVER","sa","Password1"
set highestbid = objConn.execute("select max(bid) from bid")
val = highestbid.fields(0).value
highestbid.close
IF arrmessage <= val then
strResponse = "Your bid is " & arrmessage & " and the highest bid is " & (val) & " you need to out bid the highest bidder"
elseif arrmessage > val then
'continue and insert bid in table
Set objConn = CreateObject("ADODB.Connection")
set mycommand = CreateObject("ADODB.COMMAND")
objConn.Open "Provider=SQLOLEDB.1;Data Source=OFFICE-PC\SQLEXPRESS; Initial Catalog=SMSSERVER","sa","Password1"
set mycommand = objConn.execute("update bid set bid='"& arrmessage & " 'where msisdn='" & objMessageIn.FromAddress & "'")
strResponse = "Thanks your bid of " & arrmessage & " has been recorded. To query the highest bid text keyword query"
else
你確定arrmessage和val都是數字,哪一個都不是字符串? –
'arrmessage'從哪裏來?它可能是一個字符串? –
'MsgBox TypeName(arrmessage)'報告什麼? – Bond