📄 form2.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form Form2
AutoRedraw = -1 'True
Caption = "餐馆各分店信息"
ClientHeight = 4245
ClientLeft = 60
ClientTop = 345
ClientWidth = 5730
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4245
ScaleWidth = 5730
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "关闭"
Height = 495
Left = 1680
TabIndex = 1
Top = 3360
Width = 1935
End
Begin MSFlexGridLib.MSFlexGrid msfg
Height = 2895
Left = 240
TabIndex = 0
Top = 120
Width = 5175
_ExtentX = 9128
_ExtentY = 5106
_Version = 393216
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim conn As New ADODB.Connection
Dim rs_crest As New ADODB.Recordset '分店
sqlstr = "select restregion,restaddr,resttel from contactinfo where restid=" & restid
conn.ConnectionString = "driver={sql server};server=localhost;database=restaurant;uid=tsk;pwd=810504"
conn.CursorLocation = adUseClient
conn.Open
rs_crest.Open sqlstr, conn, adOpenDynamic, adLockOptimistic
With msfg
.Rows = 1
.Cols = 4
.TextMatrix(0, 0) = "序号"
.TextMatrix(0, 1) = "城市"
.TextMatrix(0, 2) = "地址"
.TextMatrix(0, 3) = "联系电话"
.ColWidth(0) = 500
.ColWidth(1) = 1000
.ColWidth(2) = 1000
.ColWidth(3) = 1000
.ColAlignment(0) = 4
.ColAlignment(1) = 4
.ColAlignment(2) = 4
.ColAlignment(3) = 4
End With
If Not rs_crest.EOF Then
Do While Not rs_crest.EOF
With msfg
.Rows = .Rows + 1
For i = 1 To rs_crest.Fields.Count
.TextMatrix(.Rows - 1, 0) = .Rows - 1
.TextMatrix(.Rows - 1, i) = rs_crest.Fields(i - 1)
Next
rs_crest.MoveNext
End With
Loop
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -