|
-
Apr 24th, 2010, 03:37 PM
#1
Thread Starter
New Member
[RESOLVED] Updating Database Data
I am working on a project that stores data on animals. I am trying to make updates to data already stored there, through inputs on a VB form.
A form where all the data is populating the fields shows up and the user can change/update any field. Once they are finished, they click update and the DB is supposed to reflect those changes (Theoretically)
However, I wrote the code to do that, but when it runs nothing in the database is changed and nothing gets done, as it seems. No errors appear and nothing goes wrong with the program. It just doesnt change the data in the db.
any suggestions on what to do?
Here is the code updating the database.
Code:
If txtNewID.Text = "" Or cmbRegion.Text = "" Or txtWombatName.Text = "" Or cmbGender.Text = "" Or txtAge.Text = "" Or txtWeight.Text = "" Or txtLength.Text = "" Or txtCommunity.Text = "" Or txtDescription.Text = "" Then
MsgBox("Please fill in all required fields.", , "ERROR")
Else
'Updates data
Dim addCommand As New OleDbCommand
addCommand.Connection = staffConnection
addCommand.CommandText = "UPDATE wombat_data SET wombat_name ='" & txtWombatName.Text & "', region ='" & cmbRegion.Text & "', gender = '" & cmbGender.Text & "', age ='" & txtAge.Text & "', weight = '" & txtWeight.Text & "', length = '" & txtLength.Text & "', sample_description ='" & cmbSample.Text & "', community_name ='" & txtCommunity.Text & "', description ='" & txtDescription.Text & "' WHERE wombat_id =" & txtNewID.Text
Dim updateInfo As Integer = addCommand.ExecuteNonQuery()
MsgBox("Wombat data has been modified.")
End If
Last edited by honejc; Apr 24th, 2010 at 06:02 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|