Today as i was working on 1 of my projects i came across an error saying "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records". After a few minutes of troubleshooting, it turned out that the dataadapter does not allow updating tables without primarykeys as well as those tables that use Autonumbers or AutoIncrement values for their primary key, so i went back and changed the auto-generated code for my dataAdapters update command and all went pretty smoothly after...
I hope this post helps beginners like me resolve similar error that they may encounter in the future when creating VB.NET + OLEDB based systems...
Tuesday, June 28, 2011
Wednesday, April 21, 2010
Getting started working with LINQ
I was so caught up with all the hype that came with LINQ TO SQL using VB.NET, and i just can't wait to try it for myself. At first it was a little awkward as it was like SQL but jumbled around, but then after a few minutes of playing around with it i found it so useful in the sense that i would have to code lesser. I do hope that we can have LINQ to Mysql in the next few months...
Saturday, April 17, 2010
Single form instance check for MDI Apps in VB.net
I was trying to find a way to have a single instance of a form loaded every time i click on a menu button in my MDI Form. After a few times of modifying my VB.net code i cam up with the following:
i added the above code under the Click event of the OptionsToolStripMenuItem which i wanted to load only a single instance of a form
'Check if MDI Form have children
If Me.HasChildren Then
'Loop through all the mdi child and check the type of form if it matches
'the type of the form that you wanted to have only 1 instance then
'move the focus to that child form and exit
For Each ChildForm As Form In Me.MdiChildren
If TypeOf ChildForm Is frmSystemSettings Then
ChildForm.Focus()
Exit Sub
End If
Next
End If
'No instance of the form was found
'create one and add to mdi children
'lastly show the form
Dim SettingsForm As New frmSystemSettings
SettingsForm.MdiParent = Me
SettingsForm.Show()
i added the above code under the Click event of the OptionsToolStripMenuItem which i wanted to load only a single instance of a form
Thursday, April 8, 2010
Getting Started with VB.Net
Today i'am learning as much as i can as this happens to be the very first time that i laid my hands on the VB.Net. It's amazing how easier things now compared to working with stuff under it's predecessor Visual Basic 6. I believe that it wouldn't be long till i get myself used to the new stuff that came out with VB.Net...
Subscribe to:
Comments (Atom)