2012-11-08 106 views
1
strSQL = "SELECT cdlAction, " & _ 
     "cdlSerial_Number, " & _ 
     "cdlRemedyProcess " & _ 
     "From tblCustodial " & _ 
     "WHERE cdlRemedyProcess IS NULL AND LEN(cdlAction)=7 AND cdlAction<>'Dispose' AND LEFT(cdlAction,2) BETWEEN 5 AND 35 " & _ 
     "ORDER BY cdlAction" 

我在調試時在這個sql字符串中不斷收到「轉換nvarchar時轉換失敗」。我沒有看到我在這裏做錯了什麼。轉換nvarchar時轉換失敗

回答

2

我認爲鑄造左(cdlAction,2)爲int可能會這樣做。他無法將字符串與自己的int進行比較。所以強制轉換(cdlAction AS INT)可能會起作用。

+0

工作。謝謝 – Fidelis

+0

不客氣。 –