matt09524 Posted September 26, 2005 Posted September 26, 2005 Because I am still kinda learning, I used a guide to help me make this program and I modified it to my personal needs. Everything that I have coded works except that when the user hits the edit button, they can edit the fields, and it appears to save when they click save, but it won't save the new information. Also, when I hit the "create new" button, it uses the data from the original entry that I put in. this is the save button code: Private Sub Save() '[update] Try Me.BindingContext(DataSet11, _ "information").EndCurrentEdit() odaContacts.Update(DataSet11, _ "information") Catch eSave As System.Exception MessageBox.Show(eSave.Message) End Try '[see custom procedures] Me.DataSet11_PositionChanged() '[see custom procedures] ReadOnlyOn() End Sub this is how I call the sub when the button is pressed. Private Sub contacttoolbar_ButtonClick(ByVal sender As _ System.Object, ByVal e As _ System.Windows.Forms.ToolBarButtonClickEventArgs) _ Handles contacttoolbar.ButtonClick '[use tag property to select button] Select Case e.Button.Tag Case "Add" 'This is the tag property Add() 'This is the previously written Sub Case "Edit" Edit() Case "Save" Save() SetNavButtons(sender, e) Case "Clear" Cancel() SetNavButtons(sender, e) Case "Email" SendMail() Case "Delete" Delete() Case "First" NavFirst() Case "Previous" Previous() Case "Next" NavNext() Case "Last" NavLast() Case "About" About.Show() Case "Help" Help.Show() Case "Exit" Shutdown() '[use tag property to select button/] End Select End Sub Any ideas? I know the connection to the db is good because it is saving the fact that I added or deleted records, but it just won't save the information. Also.. on a side note, VB says the CASE statements may cause runtime time errors but allows me to build it regardless. Quote
bri189a Posted September 27, 2005 Posted September 27, 2005 What do you mean it doesn't save? You say it's saving to the database...that's a pretty clear case that it did save?... You mean the datagrid isn't updating? You should always rebind after altering information. Quote
matt09524 Posted September 27, 2005 Author Posted September 27, 2005 What do you mean it doesn't save? You say it's saving to the database...that's a pretty clear case that it did save?... You mean the datagrid isn't updating? You should always rebind after altering information. Yes, it does save. It updates only the new amount of records, weather deleted or added, but not any new information. rebind? how would I go about that? :D Im still learning all this stuff :) Quote
SonicBoomAu Posted September 27, 2005 Posted September 27, 2005 If it is a new record shouldn't you be using INSERT instead of UPDATE? Quote Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. -- Rick Cook, The Wizardry Compiled
matt09524 Posted September 27, 2005 Author Posted September 27, 2005 (edited) ... :eek: ya prolly :-\ /edit - INSERT does not appear to be valid. Update seems to be working fine because it is saving the NUMBER of records, just not the actual information in them. Edited September 28, 2005 by matt09524 Quote
matt09524 Posted September 29, 2005 Author Posted September 29, 2005 ... :eek: ya prolly :-\ /edit - INSERT does not appear to be valid. Update seems to be working fine because it is saving the NUMBER of records, just not the actual information in them. Well.. in my effort at trying to learn this way, I have met failure. The template I used has the same problem. The record counter that indicates "Record x of y" updates, but I don't think the actual information is updating. Could this be a misconfigured data connection? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.