作者 | 主题 |
---|---|
rission 侠圣 经验值:4545 发帖数:221 精华帖:2 |
楼主 2015-12-31 15:01:44
主题:【分享】VB脚本分享-使用脚本查询数据库动作 使用ADO连接数据库之后,可以参考一下代码查询数据并判断数据有效性 sql = "SELECT 型号,出库标记 FROM main" mainRS.Open sql, maincomm If mainRS.BOF = True And mainRS.EOF = True Then MsgBox "库存为空!" outExcelApp.Workbooks(1).Close outExcelApp.Quit Set mainRS = Nothing maincomm.Close Set outputcomm=Nothing MsgBox "退出导入过程!" outputGrid.Clear Exit Sub Else mainRS.MoveFirst Do Until (mainRS.EOF) If mainRS("型号").Value = EType Then mainOfferHad = True If mainRS("出库标记").Value = 1 Then HadType = True End If End If mainRS.MoveNext Loop End If mainRS.Close
涓涓不塞,将为江河!
|