Why doesn't my original database update when I edit the datagridview in VB 2008?
-
I had followed a tutorial on how to connect to an existing MS Access database using VB 2008. I was able to open the data source and drag the datagrid onto the form which created all the necessary adapters including the bindingsourcenavigator. In the tutorial with their existing tables, I was able to edit the datagridview on the form and click the "save" button on the navigator and see the records updated in the Access database. I created my own database and performed the same operations on my form and when I click save, the records do not update. This is the tutorial's code: Public Class Form1 --------------------------------------… Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.ClassesTableAdapter.Fill(Me.StudentsD… Me.InstructorsTableAdapter.Fill(Me.Stude… End Sub --------------------------------------… Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripButton.Click Me.InstructorsTableAdapter.Update(Me.Stu… End Sub --------------------------------------… End Class ______________________________________… This is my code from my project: Public Class Main --------------------------------------… Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEve… End Sub --------------------------------------… Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Fire_AttendanceTableAdapter.Fill(Me.F… EntryForm.Visible = False End Sub --------------------------------------… Private Sub btnAddEntry_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddEntry.Click EntryForm.Focus() EntryForm.Visible = True End Sub --------------------------------------… Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click Me.Fire_AttendanceTableAdapter.Update(Me… End Sub --------------------------------------… Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click Me.Close() End Sub --------------------------------------… Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Me.Fire_AttendanceTableAdapter.Update(Me… End Sub --------------------------------------… Private Sub Fire_AttendanceBindingNavigatorSaveItem_… sender As System.Object, ByVal e As System.EventArgs) Handles Fire_AttendanceBindingNavigatorSaveItem.… Me.Validate() Me.Fire_AttendanceTableAdapter.Update(Me… Me.Fire_AttendanceBindingSource.EndEdit(… End Sub --------------------------------------… End Class ______________________________________… NOTE: I originally wanted to edit the database using an entry form in VB, but when that failed, I attempted to find the problem by trying to edit the table directly in the datagridview which led me to this current problem.
-
Answer:
Assuming the code is the same between the example and your own DB, maybe it's a permissions issue involving the user and password in the connection string. Do you get any errors or warnings at all? I'm currently working on a project in Visual Basic which connects to a MySQL database. I found it easier (maybe that's just me) to form my own queries and execute them manually. Then the datagridview updates and my changes are saved.
Toad at Yahoo! Answers Visit the source
Related Q & A:
- Why doesn't it work when I want to click a link in my Yahoo mess list?Best solution by Yahoo! Answers
- Why doesn't my mail show up when I have new mail?Best solution by Yahoo! Answers
- Why doesn't My Yahoo page appear as I set it up?Best solution by Yahoo! Answers
- Why doesn't my address book appear when I forward mail?Best solution by Yahoo! Answers
- Why doesn't my Yahoo home page update itself daily?Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.