0
每當我單擊此命令時出現錯誤。我試圖把交易歷史記錄放在交易號和收益的字段中,其他字段僅用於庫存。VB6.0將記錄添加到數據庫(列表視圖)
Private Sub Command1_Click()
Dim earnings As Double
earnings = txtCash - txtChange
ConnectDB
rs.Open "Select TransactionNo, Earnings from Table2", db, 3, 3
rs.AddNew
rs(0) = txtNumber 'rs(1) is an auto number
rs(2) = txtProduct 'Here i got an error, it says Item cannot be found in the 'collection corresponding to the requested name or ordinal
rs(3) = txtStockLeft
rs(4) = txtPricePiece
rs(5) = txtExpiry
rs(6) = earnings
rs.Update
Set rs = Nothing
db.Close: Set rs = Nothing
LoadData1
ListView2.ListItems.Clear
LoadData
這裏有什麼問題?
它幫助我選擇所有列 ConnectDB rs.Open「表2」,DB,3,3 我只隱藏使用0寬度 隨着ListView2.ColumnHeaders 。新增,「ID」其他數據,10 .Add,,「Number」,1000 .Add,,「ProductName」,0 .Add,,「Stock」,0 .Add,,「PricePiece」,0 .Add,,「Expiry」 ,0 。添加,,「收入」,1200 – Francis
多數民衆贊成在我能夠幫助你。 – DevelopmentIsMyPassion