vb6.0 用文本框给datagrid添加数据
来源:百度知道 编辑:UC知道 时间:2024/04/18 07:17:54
datagrid+ 数个TEXTBOX一个cmd 实现
Dim Con As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Private Sub Command1_Click()
If Text1(0).Text = "" Or Text1(1) = "" Or Text1(2) = "" Then
MsgBox "请输入员工信息不能为空", 48, "提示信息"
Else
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_Test.mdb;Persist Security Info=False"
Con.Open
Set Rs = Con.Execute("insert into tb_laborage (员工姓名,所属部门,月份,基本工资,奖金) values('" + Text1(0) + "','" + Text1(1) + "','" + Text1(2) + "','" + Text1(3) + "','" + Text1(4) + "')")
Con.Close
End If
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_Test.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from tb_la