📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Public flag As Integer '记录操作标记
Public tna As String '保存表名
Public stri As String '保存标题名
Public recs As Integer '保存记录集中记录个数
Public temp As Integer
Sub Main()
pass.Show vbModal
End Sub
Public Function exesql(ByVal sql As String) As ADODB.Recordset
sql = Trim$(sql)
Set adoCn = New ADODB.Connection
Set adoRs = New ADODB.Recordset
adoCn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书管理数据库;Data Source=(local)"
adoCn.Open
Set adoRs.ActiveConnection = adoCn
adoRs.LockType = adLockOptimistic
adoRs.CursorType = adOpenKeyset
adoRs.Open sql
Set exesql = adoRs
Set adoRs = Nothing
Set adoCn = Nothing
End Function
Public Sub deldata()
Dim sql As String
sql = "delete 登陆表 "
Set adoCn = New ADODB.Connection
adoCn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书管理数据库;Data Source=(local)"
adoCn.Open
adoCn.Execute sql
adoCn.Close
End Sub
Public Sub insertdata()
Dim sql As String
sql = "insert 登陆表 values ('sa','abcd') "
Set adoCn = New ADODB.Connection
adoCn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=图书管理数据库;Data Source=(local)"
adoCn.Open
adoCn.Execute sql
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -