📄 form8.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "Msflxgrd.ocx"
Begin VB.Form Form8
Caption = "Form8"
ClientHeight = 5100
ClientLeft = 3660
ClientTop = 3540
ClientWidth = 8235
LinkTopic = "Form8"
ScaleHeight = 5100
ScaleWidth = 8235
Begin VB.CommandButton Command1
Caption = "删除(&D)"
Height = 375
Left = 2400
TabIndex = 3
Top = 4080
Width = 1215
End
Begin VB.CommandButton command2
Caption = "返回 (&X)"
Height = 375
Left = 4200
TabIndex = 0
Top = 4080
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid msgList
Height = 2295
Left = 360
TabIndex = 1
Top = 1560
Width = 7575
_ExtentX = 13361
_ExtentY = 4048
_Version = 393216
Rows = 6
Cols = 13
FixedRows = 0
FixedCols = 0
AllowUserResizing= 1
End
Begin VB.Label lblTitle
Caption = "销 售 信 息 列 表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 255
Left = 2520
TabIndex = 2
Top = 720
Width = 3015
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public txtSQL As String
Dim mrc As ADODB.Recordset
Dim MsgText As String
Private Sub Command1_Click()
Dim selectedrow As Integer
Dim cpbh, xsbh As String
Dim cnn As ADODB.Connection
Dim cmddele As New ADODB.Command
selectedrow = msgList.RowSel
If selectedrow >= 1 Then
cpbh = msgList.TextMatrix(selectedrow, 0)
xsbh = msgList.TextMatrix(selectedrow, 4)
Set cnn = New ADODB.Connection
cnn.Open ConnectString
Set cmddele.ActiveConnection = cnn
cmddele.CommandText = "xscp_delete"
cmddele.CommandType = adCmdStoredProc
cmddele.Parameters.Append cmddele.CreateParameter("xsbh0", adChar, adParamInput, 6, xsbh)
cmddele.Parameters.Append cmddele.CreateParameter("cpbh0", adChar, adParamInput, 6, cpbh)
cmddele.Parameters.Append cmddele.CreateParameter("flag", adInteger, adParamOutput)
cmddele.Execute
If cmddele("flag") = 1 Then
MsgBox "记录已被删除!", vbOKOnly + vbExclamation, "提示"
cnn.Close
End If
End If
Form_Activate
End Sub
Private Sub command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Dim i As Integer
Dim j As Integer
With msgList
.Cols = 13
For i = 0 To 12
'设置单元大小
.ColWidth(i) = 1000
'设置各列的对齐方式
.ColAlignment(i) = 0
Next i
.TextMatrix(0, 0) = "产品编号"
.TextMatrix(0, 1) = "产品名称"
.TextMatrix(0, 2) = "价格"
.TextMatrix(0, 3) = "库存量"
.TextMatrix(0, 4) = "销售商编号"
.TextMatrix(0, 5) = "销售商名称"
.TextMatrix(0, 6) = "地 区"
.TextMatrix(0, 7) = "负责人"
.TextMatrix(0, 8) = "电 话"
.TextMatrix(0, 9) = "备 注"
.TextMatrix(0, 10) = "销售时间"
.TextMatrix(0, 11) = "销售数量"
.TextMatrix(0, 12) = "销售金额"
' 固定表头
.FixedRows = 1
'表头项居中
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
End With
Set mrc = ExecuteSQL(txtSQL)
With msgList
.Rows = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
Select Case mrc.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i - 1) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i - 1) = mrc.Fields(i - 1) & ""
End Select
Next i
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -