0
HIInsert Command 데이터베이스에 삽입하지 않습니까?
누군가가이 코드
Protected Sub insert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Insert.Click
Dim mydb As New OleDbConnection
mydb = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= |datadirectory|database.mdb;Persist Security Info=True")
mydb.Open()
Dim sqlstring = "INSERT INTO [maintable] ([field1], [field2]) VALUES (@textbox1, @textbox2);"
Dim mydbcommand As New OleDbCommand(sqlstring, mydb)
TextBox1.Text = mydbcommand.Parameters.Add("@textbox1", OleDbType.VarChar).Value
TextBox2.Text = mydbcommand.Parameters.Add("@textbox2", OleDbType.VarChar).Value
mydbcommand.ExecuteNonQuery()
mydb.Close()
TextBox1.Text = ""
TextBox2.Text = ""
End Sub