|
-
Dec 16th, 2008, 04:44 PM
#1
Thread Starter
Fanatic Member
[2008] Update Error
I was just curious if anyone can see what may be wrong with the format of my following code. I don't get an error, but nothing happens with the data in the Access Database.
Code:
Using conn As New OleDbConnection(My.Settings.dcConn)
Using update As New OleDbCommand("UPDATE events SET title = @title, event_date = @event_date, time_start = @time_start, time_end = @time_end, location = @location, description = @description WHERE event_id = @event_id", conn)
update.Parameters.AddWithValue("@event_id", ep.event_id)
MessageBox.Show(ep.event_id)
update.Parameters.AddWithValue("@title", txtTitle.Text)
update.Parameters.AddWithValue("@event_date", Format(frmEventsManage.Calendar.SelectionRange.Start, "MM/d/yyyy"))
update.Parameters.AddWithValue("@time_start", Format(dtpStart.Value, "h:mm tt"))
If dtpEnd.Checked = True Then
update.Parameters.AddWithValue("@time_end", Format(dtpEnd.Value, "h:mm tt"))
ElseIf dtpEnd.Checked = False Then
update.Parameters.AddWithValue("@time_end", DBNull.Value)
End If
update.Parameters.AddWithValue("@location", txtLocation.Text)
update.Parameters.AddWithValue("@description", txtDescription.Text)
conn.Open()
update.ExecuteNonQuery()
End Using
End Using
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Dec 16th, 2008, 07:11 PM
#2
Re: [2008] Update Error
Test the return value of ExecuteNonQuery. If it's zero then there's no such ID. If it's not zero then the change IS being saved and you should follow the second link in my signature to see likely reason that you're not seeing it.
-
Dec 16th, 2008, 08:04 PM
#3
Thread Starter
Fanatic Member
Re: [2008] Update Error
So, it says 0. But how is that possible when the id DOES exist?
I know that ep.event_id is holding the ID i want because I have a messagebox popup with that value.
Last edited by Seraph; Dec 16th, 2008 at 08:38 PM.
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
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
|