Wrox Programmer Forums
|
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2012, 11:56 AM
Authorized User
 
Join Date: Jun 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help! Data access

Hi Rod,

Well I thought I could avoid making this post; but after several days of reading and trying out code I have to get help.

My problem is that I can not seem to update a table in the data base. This is what I have done:
1- I have a .mdb file that has six tables. ( Created and used with VB6).
2- In my .net project I sucessfully used the Data Source and loaded the .mdb fle and was able to view all the tables and their contents.
The data file name is MailList and one of the tables is named Category.
3- My Form1 has a Tab Control with several tabs.
4- The Second tab has a Button control and a Data Grid control with the following Properties:
DataSource set to CategoryTableBindingSource
EitMode set to EditOnKeyStroke
ReadOnly = False
SelectionMode = CellSelect

The DataGrid is setup to show only one column.

5- The Data Set name = Mail_ListDataSet
6- The Table Adapter name = CategoryTableTableAdapter
7- The CategoryTableBindingSource DataMember = CategoryTable and the DataSource = Mail_ListDataSet.

8- The button's click event has the following code:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Mail_ListDataSet.CategoryTable.AcceptChanges()
        CategoryTableTableAdapter.Update(Mail_ListDataSet.CategoryTable)
    End Sub
When I run the proram with Debug (and also in the distributed version) the DataGrid does get loaded and all the rows are displayed. I can edit the rows and also add rows; however when I click the SAVE buton the changes are not transfered to the data base file.

My VB.net is the 2010 Express version!

What am I doing wrong?
(This VB.net reminds me of COBOL, a writers cramp language; I am glad the VB.net has the IntelliSense)

Martin

Last edited by toconce; July 10th, 2012 at 12:03 PM.. Reason: format attached code
 
Old July 11th, 2012, 12:46 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Martin,

From your description I can't think what's wrong. It sounds like you're doing basically the right things.

If you email me the program at RodStephens@vb-helper.com I'll take a look.

Quote:
(This VB.net reminds me of COBOL, a writers cramp language; I am glad the VB.net has the IntelliSense)
I agree! I think if it weren't for IntelliSense it wouldn't be as verbose. But to get the full advantage of the self-documenting command style, you do need to get used to using IntelliSense to type things for you.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)





Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Access: Data Access Page sevp95 Access VBA 0 July 14th, 2008 11:07 AM
Please Help! Ms Access Data Access Pages Iashia06 Access 0 May 4th, 2006 03:29 PM
SQL Access/ASP.NET data access issue saeta57 SQL Server ASP 1 July 4th, 2004 04:29 PM
SQL Access/ASP.NET data access issue saeta57 Classic ASP Databases 1 July 4th, 2004 03:32 PM
Data access page access problem :) kev_79 Access 0 September 4th, 2003 04:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.