![]() |
Click here to advertise with us
|
|
|||||||
| Database General Discussion General discussion on database related topics |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi guys
I learned a lot in this tread I have to realize that I (hate to say it) must start over. So what I’m going to make, is a program that can:
So… I really need some advice on which kind of database I need to create/use, to make sure that the 3 above items is “do-able”. Earlier I created it (manually) without using the wizards in visual studio, but I ended up with being way over my head. I used an Access database to do this. But – as mentioned earlier – I couldn’t make it happen. ![]() Thanks for any help and hints |
|
|||
|
I'd recommend reading the DW2 link that cjard posted.
If you're a visual learner this series will be of assistance: Forms over Data Video Series Here's an article on handling concurrency issues in .NET. The article is for an ASP.NET application but it does go over some of the drawbacks of pessimistic locking and provides a couple of sample stored procedures that you could build from: 15 Seconds : Handling Concurrency Issues in .NET Last edited by MattP; 07-09-2009 at 6:10 PM. |
|
|||
|
Read it many times, and I can do it blindfold now ;-)
But I'm unfamiliar with, how to cahnge the navagtion bar? Can I somehow see the code behind the bar? Quote:
Quote:
Thanks again ! |
|
||||
|
Quote:
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
Quote:
But there is no code behind the BindingNavigatorMoveNextItem_Click, it looks like this: Code:
Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorMoveNextItem.Click
End Sub
If I can see the code, then I can get rid of the navigationsbar that the wizard created, and make my own button, with the code from "BindingNavigatorMoveNextItem_Click" in it. |
|
||||
|
As I said, the navigator is connected to a BindingSource (BindingSource property), then various buttons on the navigator is assigned particular actions (like the move next), when these buttons are clicked the corresponding action method on the BS is called. There is no client code necessary to do this in a default configuration. Have a look at the members of BindingSource class and you'll see it's obvious how they all map to the various navigator actions, you can also see this map in help for BindingNavigator Class (System.Windows.Forms)
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
||||
|
Quote:
To say John's post another way: You can't see it, because Microsoft wrote the BindingNavigator. It takes in a BindingSource as a parameter, and then simply calls bindingSource.MoveNext every time you click on what it knows to be the Next button (you tell it that too) Simply put, their code might look like this: Code:
Class BindingNavigator
Private _bs as BindingSource
Property BindSource as BindingSource
Set
_bs = value
End Set
End Property
Private _mni as Button
Property MoveNextItem as Button
Set
_mni = value
AddHandler(_mni.Click, AddressOf(MNIClickHandler))
End Set
End Property
Private Sub MNIClickHandler
_bs.MoveNext()
End Sub
End Class
When the MoveNextItem is set to a button, the click handler of that button is assigned INSIDE the bindingnavigator code to a handler that is ALSO inside the bindingnavigator code Every time you click the button, it just calls MoveNext on the bindingsource the bindingnavigator is attached to (ALSO inside the bindingnavigator code) If you want to "roll your own" MoveNext handler you HAVE to tell the BindingNavigator it has no set MoveNextItem -> Open the properties for the BindingNavigator Find the MoveNextItem setting Set it to NONE Now you can roll your own click handler in your own code
__________________
DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ |
|
||||
|
Quote:
Note for item 2, you can use pessimistic locking but it is sometimes dumb. By default doing code like DW" link in my sig shows you, creates OPTIMISTIC locking, which is "hope that noone else changed the record, but throw an exception if someone did" If 2 people d/l a record and then one changes and saves and then the other changes and saves, he gets an exception because the query is written so that old values in the client are compared with the db values. If 0 rows are affected, it means someone changed a value So when you get your exception you have to handle it: Overwrite user1's changes with user2's Keep user1's Show user 2 both sets of changes and let them choose which of each Merge the changes, letting user1's changes win if there is a conflict Merge the changes, letting user2's changes win if there is a conflict You must write this code. it is not automatic
__________________
DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|