Hi!
I'm on a small project where I have to enter and later maybe manage some data in MS Access 2007
database.
I don the writing into, deleting etc. to the database but for some reason I can't update the
desire data in the database.
Here is my code and I really tried out a lot of thinks but no way to update the data. :-(
This is not the whole code of my project of course, actually this is only the code how I connect to the
database and the button manipulating code for updating.
Can somebody watch to the code and give some idea what I does wrong?
Thank you very much.Code:Module Connection Public conn As New OleDb.OleDbConnection Public strstring As String Public Sub connections() On Error Resume Next strstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Cowboy.accdb" conn.ConnectionString = strstring conn.Open() End Sub End Module Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click On Error Resume Next Dim OleDBC As New OleDbCommand With OleDBC .Connection = conn .CommandText = "Update [Baza_zivotinja] set [Boja]='" & TextBox1.Text & "',[ID]='" & TextBox2.Text & "',[Pol]='" & TextBox3.Text & "',[Datum_osemenjivanje]='" & DateTimePicker1.Value.ToShortDateString & "',[Datum_teljenje]='" & DateTimePicker2.Value.ToShortDateString & "',[Datum_uvoza]='" & DateTimePicker2.Value.ToShortDateString & "',[Tezina]='" & TextBox4.Text & "',[ID_Oca]='" & TextBox5.Text & "',[Ime_oca]='" & TextBox6.Text & "',[ID_Majke]='" & TextBox7.Text & "',[Ime_majke]='" & TextBox8.Text & "',[Nepomena]='" & RichTextBox1.Text & "',[Uzrast]='" & TextBox9.Text & "', Where [ID] = " & TextBox2.Text & "" .ExecuteNonQuery() .Dispose() Call loaddata() End With End Sub




Reply With Quote