Dim MyConn As ADODB.connection
Set MyConn = New ADODB.connection
Dim MyRecSet1 As New ADODB.Recordset
MyConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Amber\Desktop\Trackingcustomercalls\Copy of Trackingcustomercalls.mdb"
MyConn.Open
Set MyRecSet1 = MyConn.Execute("INSERT INTO ID_ProjectNo VALUES("txtAddProjectNumber.text","txtAddCustomerName.text","txtAddMachine.text")")
MyRecSet1.Update
MsgBox "The record was added to database", vbCritical, "Succesfull adding"
MyConn.Close
我正在寻找..如何连接数据库并使用VB6插入表中。 检查上述程序是否有效。
答案 0 :(得分:1)
Set MyRecSet1 = MyConn.Execute("INSERT INTO ID_ProjectNo VALUES('" & txtAddProjectNumber.text & "','" & txtAddCustomerName.text "','" & txtAddMachine.text & "')")