Hi All, I'm new to this forum and straight off the bat I start bothering you guys with an issue, or as we call it at work a "challenge".
I'm quite new to Visual Basic and mainly have thought myself to use Visual Basic Express 2010, so I have limited knowledge about the behind the database connection (mainly use the wizard an connection functions of the program) so bare with me when i try to explain my issue.
The project I'm working on is a planning tool i'm designing to use at work. The mainform consist of 4 datagridviews filled from an access database (.mdb). The database contains multiple columns including 1 keynumber and a priority column. The 4 datagridviews are filtered on either priority 1, 2, 3 or 4. I want to be able to change the priority in of the database entries to move them either up or down using 4 sets of buttons. Now I use the following button code to change the value in the priority column and safe the data from the datagrid to the database. (datagridview number and priority value are different for every button)
The problem is that on screen everything seems to work smoothly and I'm able to shift any entry from datagrid to datagrid. However, if I then close the application and re-open it only the changes made to the first line of the database (keynumber 1) are actually saved, all other entries remain unchanged. To figure out where the problem lies I have tried manually changing the priority column in the datagridview and saving it using it with the following code (mainly the same code as before)
Changing the priority in this way does safe all the changes when re-opening the database.
I'm quite puzzled by this because I have no idea why the changes are only saved to the first row and not to any other when using the button but are changed by manually editing the values and saving it with the same code.
I hope anyone on this forum can help me solving this issue and helps me to understand what is happening.
I'm happy to supply any extra information/code if needed.
Greetings Pascal.
I'm quite new to Visual Basic and mainly have thought myself to use Visual Basic Express 2010, so I have limited knowledge about the behind the database connection (mainly use the wizard an connection functions of the program) so bare with me when i try to explain my issue.
The project I'm working on is a planning tool i'm designing to use at work. The mainform consist of 4 datagridviews filled from an access database (.mdb). The database contains multiple columns including 1 keynumber and a priority column. The 4 datagridviews are filtered on either priority 1, 2, 3 or 4. I want to be able to change the priority in of the database entries to move them either up or down using 4 sets of buttons. Now I use the following button code to change the value in the priority column and safe the data from the datagrid to the database. (datagridview number and priority value are different for every button)
Code:
DataGridView1.CurrentRow.Cells(0).Value = "2"
Me.Validate()
Me.BindingSource1.EndEdit()
Me.BindingSource2.EndEdit()
Me.BindingSource3.EndEdit()
Me.BindingSource4.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DatabaseDataSet)
Me.DatabaseDataSet.AcceptChanges()Code:
Me.Validate()
Me.BindingSource1.EndEdit()
Me.BindingSource2.EndEdit()
Me.BindingSource3.EndEdit()
Me.BindingSource4.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.DatabaseDataSet)
Me.DatabaseDataSet.AcceptChanges()
MsgBox("Update Succesfull")I'm quite puzzled by this because I have no idea why the changes are only saved to the first row and not to any other when using the button but are changed by manually editing the values and saving it with the same code.
I hope anyone on this forum can help me solving this issue and helps me to understand what is happening.
I'm happy to supply any extra information/code if needed.
Greetings Pascal.