📄 frmhwbmquery.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form frmHwbmQuery
Caption = "货物查询"
ClientHeight = 4245
ClientLeft = 2370
ClientTop = 2400
ClientWidth = 8145
LinkTopic = "Form1"
LockControls = -1 'True
ScaleHeight = 4245
ScaleWidth = 8145
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 525
Left = 180
TabIndex = 1
Top = 3570
Width = 2205
End
Begin MSFlexGridLib.MSFlexGrid Flex
Height = 3405
Left = 150
TabIndex = 0
Top = 90
Width = 7215
_ExtentX = 12726
_ExtentY = 6006
_Version = 393216
Cols = 6
AllowUserResizing= 3
FormatString = "|<货物分类码|<货物分类名称|<货物编码|<货物名称|>货物单价"
End
End
Attribute VB_Name = "frmHwbmQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'定义连接、记录集两个对象变量
Dim Conn As ADODB.Connection
Dim Rs As ADODB.Recordset
Private Sub Command1_Click()
On Error GoTo Errorhandle
'下ERP002服务器上的FITERP数据库建立连接
Set Conn = New ADODB.Connection
Conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=;Initial Catalog=fiterp;Data Source=ERP002"
Conn.Open
Flex.Rows = 1
'声明一个新的Rs记录集对象
'并使用RS对象的OPEN方法执行VBSQLPROQUERY存储过程
Set Rs = New ADODB.Recordset
Set Rs.ActiveConnection = Conn
Rs.Open "{CALL VBSQLPROQUERY}"
'将执行存储过程返回的数据在列表中列出
Do While Not Rs.EOF
Flex.AddItem vbTab & Rs(0) & vbTab & Rs(1) & vbTab & Rs(2) & vbTab & Rs(3) & vbTab & Rs(4)
Rs.MoveNext
Loop
Rs.Close
Conn.Close
Set Conn = Nothing
Set Rs = Nothing
Exit Sub
Errorhandle:
Set Conn = Nothing
Set Rs = Nothing
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -