📄 form_connrec.frm
字号:
VERSION 5.00
Begin VB.Form Frm_ConnRec
Caption = "F:\四维科技\未完图书\DW开发系列"
ClientHeight = 2220
ClientLeft = 60
ClientTop = 345
ClientWidth = 4380
LinkTopic = "Form1"
ScaleHeight = 2220
ScaleWidth = 4380
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text3
Height = 375
Left = 1080
TabIndex = 5
Text = "Text1"
Top = 1200
Width = 2655
End
Begin VB.TextBox Text2
Height = 375
Left = 1080
TabIndex = 4
Text = "Text1"
Top = 720
Width = 2655
End
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 3
Text = "Text1"
Top = 240
Width = 2655
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "年龄"
Height = 180
Left = 480
TabIndex = 2
Top = 1200
Width = 360
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "姓名"
Height = 180
Left = 480
TabIndex = 1
Top = 720
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "学号"
Height = 180
Left = 480
TabIndex = 0
Top = 360
Width = 360
End
End
Attribute VB_Name = "Frm_ConnRec"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim myConn As New ADODB.Connection
Private Sub Form_Load()
Dim mySQL As String
Set myConn = New ADODB.Connection
mySQL = "Provider=SQLOLEDB.1;Persist Security Info=False;"
mySQL = mySQL + "User ID=sa;Initial Catalog=图书馆管理系统;"
mySQL = mySQL + "Data Source=(local)"
myConn.ConnectionString = mySQL
myConn.Open '打开Connection连接
'通过Connection对象的Execute创建Recordset对象
mySQL = "select * from 学生信息表"
Set myRec = myConn.Execute(mySQL)
Text1.Text = myRec("学号")
Text2.Text = myRec("姓名")
Text3.Text = myRec("年龄")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -