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

📄 module1.bas

📁 学生信息管理系统 毕业设计 vb+sql
💻 BAS
字号:
Attribute VB_Name = "Module1"
Public Function executesql(ByVal sql As String, msgstring As String) As Adodb.Recordset
Dim cnn As Adodb.Connection
Dim rst As Adodb.Recordset

Dim stokens() As String
    On Error GoTo executesql_error
    stokens = Split(sql)
    Set cnn = New Adodb.Connection
    cnn.Open connectstring
    If InStr("insert,delete,update", UCase$(stokens(0))) Then
       cnn.Execute sql
       msgstring = stokens(0) & "query successful"
    Else
       Set rst = New Adodb.Recordset
       rst.Open (sql), cnn, adOpenKeyset, adLockOptimistic
       Set executesql = rst
       msgstring = "查询到" & rst.RecordCount & "条记录"
    End If
executesql_exit:
    Set rst = Nothing
    Set cnn = Nothing
    Exit Function
executesql_error:
 msgstring = "查询错误:" & Err.Description
 Resume executesql_exit
 End Function
Public Function connectstring() As String
connectstring = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=xsgl;Data Source=(local)"
End Function
Sub Main()
Dim flogin As New frmLogin
flogin.Show vbModal

Unload flogin
Set fmainform = New FrmMain
fmainform.Show
End Sub
Public Function testtxt(txt As String) As Boolean
If Trim(txt) = "" Then
   testtxt = False
Else
   testtxt = True
End If
   End Function

⌨️ 快捷键说明

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