2016-04-27 25 views
-1
STSQL = "select STOCKROOM_QTY from mpcs.si_mtipart_info where inv_type = '" & rsMPCS("inv_type") & "' and mti_part_no = '" & rsMPCS("mti_part_no") & "'" 
    rsMPCS2 = MPCS_SELECT_SQL(UCase(STSQL)) 
    If rsMPCS2.HasRows Then 
     Dim CurrentQuan As Long = rsMPCS2("STOCKROOM_QTY") 

     STSQL = "update mpcs.si_mtipart_info set STOCKROOM_QTY = " & (CurrentQuan - NumericUpDown1.Value) & " where inv_type = '" & rsMPCS("inv_type") & "' and mti_part_no = '" & rsMPCS("mti_part_no") & "'" 
     MPCS_UPDATE_SQL(UCase(STSQL)) 

上面的代碼是一個從一個更改Oracle表上的STOCKROOM_QTY的一部分。SQL選擇拋出異常,說數據不存在

我得到的錯誤是enter image description here

但是,如果我運行它發送select STOCKROOM_QTY from mpcs.si_mtipart_info where inv_type = MACH_PART' and mti_part_no = '01400010005'

select語句你可以看到它存在。

enter image description here

沒有理由向下表決,因爲你不喜歡做的方式。我研究了它,儘可能清楚(甚至給了照片),這也付出了努力。沒有任何進一步的信息,人們能夠輕鬆看到問題。

+0

首先可能的SQL注入。 – lad2025

+3

你的錯誤是'沒有數據存在的行/列'不是你的列不存在;存在 –

+0

好吧我打錯了,但數據確實存在沒有正確的嗎?而且lad2025,我知道我正在經歷並最終修復這些東西,現在它的內部應用程序只能訪問外部,但我及時繼承了這些代碼。 – Lee

回答

1

看來,您使用的是數據讀取器。在這種情況下,您必須在訪問任何數據之前調用其Read方法。

+0

它總是那些小東西,偉大的眼睛Jmcilhinney,就是這樣。傻我錯過了。謝謝。 – Lee