Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim cn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp\db1.mdb;Persist Security Info=False")
Dim cmd As New Data.OleDb.OleDbCommand
With cmd
cn.Open()
.CommandText = "Update test1 set t2=?,t3=? where t1=?"
.Connection = cn
.Parameters.Add("t1", OleDb.OleDbType.Decimal)
.Parameters.Add("t2", OleDb.OleDbType.BSTR)
.Parameters.Add("t3", OleDb.OleDbType.DBDate)
.Parameters.Item(0).Value = TextBox1.Text
.Parameters.Item(1).Value = TextBox2.Text
.Parameters.Item(2).Value = Convert.ToDateTime(TextBox3.Text)
.ExecuteNonQuery()
cn.Close()
End With
End Sub
沒有留言:
張貼留言