Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2005, 07:23 PM
Authorized User
Points: 111, Level: 2
Points: 111, Level: 2 Points: 111, Level: 2 Points: 111, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default BindingNavigator Question

I am doing the examples in the books and I can't make the BindingNavigator controls delete or add to my data base. I am using an existing Access Table for the data source. When I add or delete records it does show as happening in the current screen. I then do a save, reload, and all the original stuff is back on the screen. It is almost like I am missing something here that makes the table "read Only" or something like that.

Any help would be appreciated.

Thanks,
George javascript:insertsmilie(':)')
Smile :)
Reply With Quote
  #2 (permalink)  
Old December 5th, 2005, 08:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

1) Tell us if u r working on XP.

2) Post the code u wrote to perform the task, there may be something wrong with that.

Regards
Ankur Verma
Reply With Quote
  #3 (permalink)  
Old December 5th, 2005, 06:05 PM
Authorized User
Points: 111, Level: 2
Points: 111, Level: 2 Points: 111, Level: 2 Points: 111, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I am using Windows XP Professional with Service Pack 2.

The code I am using to save data is:

Private Sub ProjectsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProjectsBindingNavigatorSaveItem.Click

If Me.Validate Then
            Me.ProjectsBindingSource.EndEdit()
            Me.ProjectsTableAdapter.Update(Me.MKADataSet.proje cts)
        Else
            System.Windows.Forms.MessageBox.Show(Me, "Validation errors occurred.", _
            "Save", System.Windows.Forms.MessageBoxButtons.OK, _
            System.Windows.Forms.MessageBoxIcon.Warning)
        End If
    End Sub

Hope that helps. Have been trying to find an example of working code but no luck so far.

Thanks,
George Race

Reply With Quote
  #4 (permalink)  
Old December 5th, 2005, 08:27 PM
Authorized User
Points: 111, Level: 2
Points: 111, Level: 2 Points: 111, Level: 2 Points: 111, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried something from the examples:

  Try
            Me.Validate()
            Me.ProjectsBindingSource.EndEdit()
            Me.ProjectsTableAdapter.Update(Me.MKADataSet.proje cts)
            MsgBox("Update successful")

        Catch ex As Exception
            MsgBox("Update failed")
        End Try

Got the same results with Update Successful each time. Still When I reopen the database no changes were saved.
Thanks,
George

Reply With Quote
  #5 (permalink)  
Old December 6th, 2005, 02:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

George, your code is fine and should work. Just make sure that the mdb file is not readonly.
You may even find that you are not able to remove the "Read Only" attribute of the mdb file. To be able to remove the readonly attribute, you need to have proper rights specified in the file's and its folder's ACLs.
Like if you copy the file in a folder on which your user has enough credentials (like "User Name"\My Documents), you will be able to remove the readonly attribute. Or you can modify the ACLs and then remove the readonly attribute.
Such issues are quite common in XP, though, and somewhat conform to the fact that XP has better inbuilt security infrastructure.

Regards
Ankur
Reply With Quote
  #6 (permalink)  
Old December 6th, 2005, 09:59 PM
Authorized User
Points: 111, Level: 2
Points: 111, Level: 2 Points: 111, Level: 2 Points: 111, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ankur:

Boy, I am just not having any luck at all with this situation. The files are not read only and I am the administrator of the system so have full rights in all directories. I have noticed one thing that may be important. When I open the Database Explorer my MKA.mdb file has a small red X in the lower right corner of the symbol. If I check on refresh the Red X goes away and it looks like there may be a black key in place of the red X.

Not sure if this has any bearing on the problem that I am having. No matter what I do, I just cant seem to save any changes that I make to the database.

When I use the "try" example I always get back "Update successful" but again there is never a change in the database. Does not matter if I add records or delete records, the database does not seem to change.

What next?

I am really getting frustrated with what should be a simple procedure.

George
Reply With Quote
  #7 (permalink)  
Old December 7th, 2005, 12:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

That small red X shows disconnection and as soon as u refresh or expend the node it disappears indicating that the connection is established. This small x doesnt matter 'cause it disappears, whould have mattered if it werent.

We all usually work with Administrator's privilages on our systems, this problem is quite common still, if you are working on XP. So I'll again ask you to see the 'file attributes' of your mdb file in windows explorer or cmd and make sure that 'read only' is not checked.

Regards
Ankur Verma
Reply With Quote
  #8 (permalink)  
Old December 9th, 2005, 02:49 PM
Authorized User
Points: 111, Level: 2
Points: 111, Level: 2 Points: 111, Level: 2 Points: 111, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, and the file is definately not Read Only!

Seems like this should be easy but I can't make any of the examples delete or save data using the BindingNavigator controls.

Can you email me an attachment containing an example of one that works?

george@mrrace.com

Thanks,
George

Reply With Quote
  #9 (permalink)  
Old December 9th, 2005, 05:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Sent you one.
Reply With Quote
  #10 (permalink)  
Old December 9th, 2005, 10:12 PM
Authorized User
Points: 111, Level: 2
Points: 111, Level: 2 Points: 111, Level: 2 Points: 111, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Ankur:
Well you did it! I now have the code working. The example you sent would not work in the location I put it. Could not find the .mdb file. In looking at the error I saw that your file was pointing to a different location. So....I opened the "app.config" file and inserted my address string to the file. It worked perfectly after that!

That got me thinking so I went and looked at the "app.config" file for my program directory. It was marked: ....[DataDirectory] MKA.mdb (MKA.mdb is my Access Data File) I pasted in place of "DataDirectory" the actual path to my mdb file and everything started to work!

When I imported the .mdb file to the project, I wonded if some kind of a problem occured and it actually left the "DataDirectory" path pointing back to my original location before the import. That would explain why I saw changes in the "real" directory in my Access Program as I was playing around with the Visual Basic version that I am trying to convert/write.

Anyway Ankur your code file led me to the answer. I am sure I will have more questions as I proceed with this very complicated conversion from Access to VB. It will be a great learning experience for me and I hope you don't mind me coming back to you often for help and answers.

Thank you so much for the help and sticking in there with me to the end.

Sincerely,
George Race

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning 2 BindingSources to a BindingNavigator Bjay Pro VB Databases 3 July 19th, 2007 07:17 AM
BindingNavigator Exception osorio.agustin Visual Basic 2005 Basics 0 March 13th, 2007 08:39 PM
bindingNavigator problem! angelran C# 2005 2 January 21st, 2007 05:57 AM
Bindingnavigator ldg_louie Visual Basic 2005 Basics 0 June 8th, 2006 07:02 PM
BindingNavigator Question lixin8111 Visual Basic 2005 Basics 0 May 25th, 2006 09:34 PM



All times are GMT -4. The time now is 08:15 AM.


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