⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 vb数据库编程资料
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   1125
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5250
   LinkTopic       =   "Form1"
   ScaleHeight     =   1125
   ScaleWidth      =   5250
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "建立到教学数据库的连接"
      Height          =   495
      Left            =   1080
      TabIndex        =   0
      Top             =   120
      Width           =   2295
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim CnB As New ADODB.Connection
Dim Sqlstr As String
Private Sub Command2_Click()
 Dim Cnbstring As String
 Cnbstring = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & App.Path & "\教学.mdb"
 With CnB
     .ConnectionString = Cnbstring
     .ConnectionTimeout = 10
     .Open '给连接的ConnectionString属性赋值,然后使用求带参数的Open方法打开连接
  End With
  MsgBox ("连接成功")
  Sqlstr = "Insert into 学生表(学号,姓名) Values('0001020','周小华')"
  CnB.Execute Sqlstr
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -