473,396 Members | 1,764 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,396 software developers and data experts.

Databinding manager

I have a form with text boxes bind with dataset of a table like Customer
with a CustomerID field.
I bind the dataset with binding manager and I want to add new record.
I called the AddNew() of the binding manager to add a new record, however, I
need to know the MemberID of the last record and add 1 to it and assigned to
the new record, how do I do that ?
Nov 20 '05 #1
1 1000
Hi Alan,

It is recommended to configure the corresponding DataTable column as
AutoIncrement, but set the initial value to -1 and increment also to -1.
Thus, the IDs of newly added rows will never conflict with the existing
ones. When the changes are propagated back to the database, you always know
that rows with negative IDs are new ones and call the appropriate stored
procedure which would create a new record instead of updating an existing
one.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Alan" <NO**************@yahoo.com.au> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
I have a form with text boxes bind with dataset of a table like Customer
with a CustomerID field.
I bind the dataset with binding manager and I want to add new record.
I called the AddNew() of the binding manager to add a new record, however, I need to know the MemberID of the last record and add 1 to it and assigned to the new record, how do I do that ?


Nov 20 '05 #2

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

Similar topics

0
by: Jeff | last post by:
I am having a behaviour problem with Databinding on a C# WinForm. I have three textboxes and a Checkbox bound to a dataset. The desired behaviour is when I check/uncheck the checkbox, I want to...
0
by: Stephan Steiner | last post by:
Hi I'm trying to temporarily suspend a databinding between a DataTable and a DataGrid. I create a CurrencyManager based on this.BindingContext and then call SuspendBinding() on the...
15
by: Tim Jarvis | last post by:
Hi, I have an object that I am binding to a text box, this object exposes a boolean field, and I have implemented a format event handler and a parse event handler for the binding object, where I...
3
by: Sonny | last post by:
We are upgrading a VB6 app to VB.Net. It seems that when binding a dataview/datatable to a combobox, the property ValueMember and DisplayMember are case sensitive. So I must enter the field name...
4
by: pmcguire | last post by:
Can someone explain to me the difference between these two bindings? dim b as Binding b=New Binding(dsMyDataset.tblMyTable, "colMyColumn") b=New Binding(dsMyDataset,...
0
by: Dave Taylor | last post by:
I posted this to the vb.data group, but have had no luck. I'm still very stuck on this problem...it seems the DataBinding works perfectly the first time an instance of the form is created. The...
2
by: ECathell | last post by:
'------------------------------------------------------------------------------------------------ 'Label Formats...
7
by: Vlado Jasovic | last post by:
Hello, I'm using typed dataset for databinding to windows controls and I'm having some problems. I'm trying to move all business logic to datatable column_changing events and the problem that...
5
by: Patrick | last post by:
I've been struggling with a while. Could someone please help me out? I need to bind a property (wich is an custom object) to a combobox that contains a list of the same objects. ex: class...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.