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

📄 module4.bas

📁 南海舰队进销存管理系统 vb
💻 BAS
字号:
Attribute VB_Name = "Module4"
Option Explicit
Private rs As New ADODB.Recordset
Private strconn As String
Private strsql As String

Sub xulang3()
On Error Resume Next
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\jxc.mdb"
strsql = "select * from base"
With rs
    If .State = adStateOpen Then
       .Close
    End If
    .ActiveConnection = strconn
    .Source = strsql
    .LockType = adLockOptimistic
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open
End With
rs.AddNew
rs(0) = addbaseform1.Text1.Text
rs(1) = addbaseform1.Text2.Text
rs(2) = addbaseform1.Text3.Text
rs(3) = addbaseform1.Text4.Text
rs(4) = addbaseform1.Text5.Text
rs(5) = addbaseform1.Text6.Text
rs(6) = addbaseform1.Text7.Text
rs(7) = addbaseform1.Text8.Text
rs.Update
Set rs = Nothing
strsql = "select * from base"
With rs
    If .State = adStateOpen Then
       .Close
    End If
    .ActiveConnection = strconn
    .Source = strsql
    .LockType = adLockOptimistic
    .CursorLocation = adUseClient
    .CursorType = adOpenDynamic
    .Open
End With
Set baseform1.DataGrid1.DataSource = rs
Set baseform1.Adodc1.Recordset = rs
With baseform1.DataGrid1
.Columns(0).Width = 1200
.Columns(1).Width = 1400
.Columns(2).Width = 1400
.Columns(3).Width = 1400
.Columns(4).Width = 1400
.Columns(5).Width = 1200
.Columns(6).Width = 1200
.Columns(7).Width = 1200
End With
baseform1.Adodc1.Caption = "当前记录为:" & baseform1.Adodc1.Recordset.AbsolutePosition & "/" & baseform1.Adodc1.Recordset.RecordCount
addbaseform1.Text1.Text = ""
addbaseform1.Text2.Text = ""
addbaseform1.Text3.Text = ""
addbaseform1.Text4.Text = ""
addbaseform1.Text5.Text = ""
addbaseform1.Text6.Text = ""
addbaseform1.Text7.Text = ""
addbaseform1.Text8.Text = Format(Now, "yyyy-mm-dd")
End Sub

⌨️ 快捷键说明

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