|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
各位老师:
以下是我准备将窗口数据写入到数据库的程序,运行后没有任何提示,数据不能被写入,劳烦大家帮我看看错在什么地方?谢谢!!!~
Dim RS1 As Recordset
Dim DB1 As Database
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim STPath, strSQL As String
STPath = "Provider=sqloledb;Server=KINGMED-99C972D;Database=人员培训档案;Uid=sa;Pwd=;"
On Error GoTo 4000
Set DB1 = OpenDatabase("", False, False, "ODBC; DSN=人员培训档案; WSID==**;; DATABASE = 人员培训档案")
Set RS1 = DB1.OpenRecordset(Name:="团体个人信息表", Type:=dbOpenDynaset)
With RS1
.AddNew
RS1("姓名工号") = Me.TextBox1.Value
RS1("学科") = Me.ComboBox1.Value
RS1("子实验室") = Me.ComboBox3.Value
RS1("开始时间") = Me.DTPicker2.Value
RS1("状况") = Me.ComboBox5.Value
RS1("拟培训技术级别") = Me.ComboBox2.Value
RS1("入科时间") = Me.DTPicker1.Value
RS1("结束时间") = Me.DTPicker3.Value
.Update
End With
MsgBox "记录增加完毕"
DB1.Close |
|