郎朗坤
Dim oleCn As New OleDbConnection
Dim oleCd As New OleDbCommand
Dim oleDr As OleDbDataReader
Dim oleAd As New OleDbDataAdapter
Dim ds As New DataSet
然后就能把textBox中的数据添加到数据库中
Private Sub Command1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command1.Click
oleCn.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & databasename
oleCd.Connection = oleCn
oleAd.SelectCommand = oleCd
ds.Tables.Add("t")
Dim sql As String
sql = "insert into " & tblName & "(字段名1,字段名2,字段名3 , ....) Values('" _
& TextBox1 & "','" & TextBox2& "','" & TextBox3 ......& "')"
oleCd.CommandText = sql
oleCd.Connection.Open()
oleCd.ExecuteReader()
oleCd.Connection.Close()
End Sub
这样是最最最简单的了,可不能再晕了阿!