VBScript更新查询 [英] VBScript update query
问题描述
嗨
我有以下vbscript,该脚本从表中提取数据,然后从提取的订单项中提取信息,然后将这些订单项插入到Excel工作表中.
脚本工作100%.
现在,我需要隐含更改,那就是当我遍历订单项并将该项目插入excel电子表格时,我想将该订单项的状态从未提取到已提取提取为更新.
这是代码的那一部分.您能协助我使更新生效吗?
Hi
I have the following vbscript that extract data from a table and then itterating through the line items extracted and insert these line items into an excel sheet.
The script works 100 %.
I now need to impliment a change and that is when I itterate through the line items and the item is inserted into the excel spreadsheet I want to update that line items status from i.e not extracted to extracted.
Here is that portion of the code. could you assist me in order to get the update to work.
SQL3 = "SELECT * FROM PO_ITEM_Details WHERE Folder_ID = '" & FolderID & "' and Quantity_Received > 0"
rstInv.Open SQL3, objcn
WHILE NOT rstInv.EOF and x < 10
x = x + 1
objSht.Cells((47 + x),2).Value = rstINV("Item_Number")
objSht.Cells((47 + x),3).Value = rstINV("Description")
objSht.Cells((47 + x),4).Value = rstINV("Quantity_Received")
objSht.Cells((47 + x),5).Value = rstINV("UOM")
objSht.Cells((47 + x),6).Value = rstINV("Unit_Price")
objSht.Cells((47 + x),7).Value = rstINV("Currency1")
objSht.Cells((47 + x),8).Value = rstINV("EXT_Price")
objSht.Cells((47 + x),9).Value = rstINV("New_EXT_Price")
rstInv.MoveNext
WEND
rstInv.Close
推荐答案
您可以在循环中使用它
You can use this in loop
rstINV("Item_Status") = "Extracted"
rstINV.Update
rstInv.MoveNext
您可能需要设置锁和其他内容
You might need to set lock and other stuff
rstInv.CursorLocation = 3
rstInv.Open SQL3, objcn, 3, 3
参考: http://www .cruto.com/resources/vbscript/vbscript-examples/misc/database/Update-a--Record-in-a-Recordset.asp [
Ref:http://www.cruto.com/resources/vbscript/vbscript-examples/misc/database/Update-a--Record-in-a-Recordset.asp[^]
这篇关于VBScript更新查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!