金蝶VB插件开发,获取后台数据库数据
Private Sub m_BillInterface_MenuBarClick(ByVal BOSTool As K3ClassEvents.BOSTool, Cancel As Boolean) 'TODO: 请在此处添加代码响应事件 Select Case BOSTool.ToolName Case "test" //按钮为test的响应该事件 '此处添加处理test 菜单对象的 Click 事件 Dim i% Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim strcn As String, strsql As String strcn = "provider=sqloledb;server=127.0.0.1;uid=sa;pwd=123;database=AIS20170629134733;" //数据库相关信息 strsql = "select FName from t_stock " //查询金蝶后台数据表的SQL语句查询(仓库数据) cn.Open strcn rs.Open strsql, cn MsgBox rs("FName") cn.Close Case Else End Select End Sub