473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ADO.NET 2.0 Question - LearnVisualStudio.Net tutorial

I ran though the ADO.NET tutorials on www.LearnVisualStudio.Net (also
available from msdn.microsoft.com) for VB 2005 - specifically lesson 9 of
"Visual Basic 2005 Express Edition for Beginners"
To my dismay, after following the tutorial a couple of times, it ends with
the presenters app functioning correctly while mine does not. The issue is
that when we execute the following code to save changes to the database,
then close the app and restart, my changes are not saved while his
apparently are.
------------------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

'need to get any changes that were made to the bindings source and place in
dataset

Me.BindingSource1.EndEdit() 'propagates changes made to data on form to
dataset

Dim rowsaffected As Integer = 0

rowsaffected = CustomerTableAdapter1.Update(MyCompanyDataSet1.Cus tomer)
'updates database and returns number of rows updated

MessageBox.Show(rowsaffected.ToString)

End Sub

-------------------------------------------

The author of the tutorial was working with Beta 2 so I'm not sure if there
is something missing in the tutorial or perhaps someting I missed twice
while following along.
Any tips on what may be missing are greatly appreciated.

-m
Dec 29 '05 #1
3 1302
Mike,

Me.BindingSource1.EndEdit() 'propagates changes made to data on form to
dataset


Probably this has to be EndCurrentEdit because that propogates changes made
to data on a form to a dataset.

I hope this helps,

Cor
Dec 29 '05 #2
Unfortunately, the EndCurrentEdit method does not exist in this context.
ms-help://MS.VSExpressCC.v80/MS.NETFramework.v20.en/cpref17/html/T_System_Windows_Forms_BindingSource_Members.htm
-m

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:el*************@TK2MSFTNGP09.phx.gbl...
Mike,

Me.BindingSource1.EndEdit() 'propagates changes made to data on form to
dataset


Probably this has to be EndCurrentEdit because that propogates changes
made to data on a form to a dataset.

I hope this helps,

Cor

Dec 29 '05 #3
Mike,
Unfortunately, the EndCurrentEdit method does not exist in this context.


That was why I wrote probably.

Normally we do it in this way.

BindingContext(ds.Tables(0)).EndCurrentEdit()

Where ds.Table(0) represent your table or defaultview of that.

(There are in my opinion still many flaws in the documentation, there is
told that it is one of the major goals to get rid of those, so I am not sure
if this is one, however the EndEdit has never done what you told it should
do.).

http://msdn2.microsoft.com/en-us/lib...d.endedit.aspx

while this does it.

http://msdn2.microsoft.com/en-us/lib...rrentedit.aspx

Probably will this do it as well

BindingContext(directcast(BindingSource1,DataTable )).EndCurrentEdit
and if this gives an error than
BindingContext(directcast(BindingSource1,DataView) ).EndCurrentEdit

You tell than what object in the bindingsource is affected and do using the
bindingcontext an endcurrentedit on it.

All typed nothing tested so watch errors.

I hope this helps,

Cor
Dec 29 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rhino | last post by:
Can anyone point me to a good free XSLT Tutorial online? I looked for some a few months ago and didn't find anything very good. I'm hoping some of the experts here can point me to a good XSLT...
15
by: binnyva | last post by:
Hello Everyone, I have just compleated a JavaScript tutorial and publishing the draft(or the beta version, as I like to call it) for review. This is not open to public yet. The Tutorial is...
18
by: Xah Lee | last post by:
i've started to read python tutorial recently. http://python.org/doc/2.3.4/tut/tut.html Here are some quick critique: quick example: If the input string is too long, they don't truncate it,...
2
by: ornot2b | last post by:
Learnvisualstudio.net web site Although the information on this site is very helpful and I have gained from being a subscriber, I think that their support area is very poor. They provide two means...
11
by: Magnus Lycka | last post by:
While the official Python Tutorial has served its purpose well, keeping it up to date is hardly anyones top priority, and there are others who passionately create really good Python tutorials on...
4
by: Liz | last post by:
Anyone have any opinions on the videos at www.learnvisualstudio.net ? Thanks ... L
2
by: minipostbil | last post by:
Really want this, would be very glad if someone could help.. i´m most interested in the C# videos and how to use visualstudio videos..
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.