module1.bas

来自「计件工资统计系统 我的毕业设计 包含论文」· BAS 代码 · 共 47 行

BAS
47
字号
Attribute VB_Name = "Module1"
Public username As String
Sub delsql(sql)
  Dim conn As New ADODB.Connection
'Dim rs As New ADODB.Recordset

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\database.mdb;Persist Security Info=False"
conn.Open
conn.Execute (sql)
End Sub

Function sumsql(sql) As Integer
  Dim conn As New ADODB.Connection
  Dim rs As New ADODB.Recordset
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\database.mdb;Persist Security Info=False"
conn.Open
rs.Open sql, conn, adOpenStatic, adLockOptimistic
sumsql = rs.RecordCount
End Function

Function execsql(sql) As Integer
  Dim conn As New ADODB.Connection
'Dim rs As New ADODB.Recordset

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\database.mdb;Persist Security Info=False"
conn.Open
Set rs = conn.Execute(sql)
execsql = rs("num")
End Function

Function DanJiaKey(KeyAscii As Integer, text As String) As Integer   '控制单价格式
  DanJiaKey = KeyAscii
If Len(text) - InStr(text, ".") = 4 Then
   DanJiaKey = 0
  End If
  If KeyAscii < 47 Or KeyAscii > 58 Then
     DanJiaKey = 0
  End If
  If KeyAscii = 46 Then
     DanJiaKey = 46
  End If
    If KeyAscii = 8 Then
     DanJiaKey = 8
  End If

End Function

⌨️ 快捷键说明

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