首先,工程->引用->Microsoft ActiveX Data Objects 2.5 Library
表名 b,字段c
Private Sub Command1_Click()
Dim cnDk As New ADODB.Connection
Dim strDk As String
Dim rDk As New ADODB.Recordset
Dim sql As String
strDk = "driver={sql server};server=(local);uid=sa;pwd=123456;database=a" '这个字符串要改成你需要的
cnDk.Open strDk
sql = "insert into b (c) values ('" & text1.text & "')"
cnDk.Execute sql
cnDk.Close
Set cnDk = Nothing
End Sub