Hi all
I have a simple datagrid form which has 4 columns. The first one is used
just like a key and the other threes allow user to enter numbers. The
problem that I am having is that when I click on a cell of a new row but
decide not to enter a value and go back to any of the previous rows for
editting or whatever reason, the value of the new row will be incremented by
value of the AutoIncrementSt ep
Here is the problem I have
When I loaded the table for a first time, the first row has a value of 0 in
column 1. I then entered 5, 5, 5 in column 2, 3, and 4 respectively. I
clicked on the 2nd row (new row), a new value of 1 was in column 1
(everything is fine up to this point). Instead entering values for column 2,
3 and 4, I went back to my row 1 to edit the data. I then came back to my
second row and enter values for my columns 2, 3 and 4. I noticed that the
value of row 2 is now 2 not 1 and it seems like the number keeps on
incrementing.
Can we make the number increment only when an actual new row is created ? I
have included the code for column 1, all others are pretty much the same.
Dim mInputTable As New DataTable
Dim IDColStyle As New DataGridTextBox Column
Dim mIDCol As New DataColumn
'Initialize node column
mIDCol.ColumnNa me = "Node ID"
mIDCol.Caption = "Node ID"
mIDCol.AutoIncr ement = True
mIDCol.AutoIncr ementSeed = 0
mIDCol.AutoIncr ementStep = 1
mIDCol.DataType = GetType(Integer )
IDColStyle.Mapp ingName = "Node ID"
IDColStyle.Null Text = ""
IDColStyle.Widt h = 72
IDColStyle.Read Only = True
IDColStyle.Head erText = mIDCol.Caption
TableStyle.Grid ColumnStyles.Ad d(IDColStyle)
dgdInput.TableS tyles.Add(Table Style)
dgdInput.DataSo urce = mInputTable 1 1636
Sam,
I dont know why it happens in this case, however in my opinion is what is
the value of an autoincrement number is not important at all.
The value will be setted to a new number at update time, where when other
users has changed as well some row the start point will than be the actual
seed point of the database.
It is good to set the seed, the increment of that and the steps by the way.
And than use -1 for all. http://msdn.microsoft.com/library/de...ementTopic.asp
I hope this helps something?
Cor
"Sam" <qd*@datawave.c a> Hi all
I have a simple datagrid form which has 4 columns. The first one is used just like a key and the other threes allow user to enter numbers. The problem that I am having is that when I click on a cell of a new row but decide not to enter a value and go back to any of the previous rows for editting or whatever reason, the value of the new row will be incremented by value of the AutoIncrementSt ep
Here is the problem I have
When I loaded the table for a first time, the first row has a value of 0 in column 1. I then entered 5, 5, 5 in column 2, 3, and 4 respectively. I clicked on the 2nd row (new row), a new value of 1 was in column 1 (everything is fine up to this point). Instead entering values for column 2, 3 and 4, I went back to my row 1 to edit the data. I then came back to my second row and enter values for my columns 2, 3 and 4. I noticed that the value of row 2 is now 2 not 1 and it seems like the number keeps on incrementing.
Can we make the number increment only when an actual new row is created ? I have included the code for column 1, all others are pretty much the same. Dim mInputTable As New DataTable
Dim IDColStyle As New DataGridTextBox Column
Dim mIDCol As New DataColumn
'Initialize node column
mIDCol.ColumnNa me = "Node ID"
mIDCol.Caption = "Node ID"
mIDCol.AutoIncr ement = True
mIDCol.AutoIncr ementSeed = 0
mIDCol.AutoIncr ementStep = 1
mIDCol.DataType = GetType(Integer )
IDColStyle.Mapp ingName = "Node ID"
IDColStyle.Null Text = ""
IDColStyle.Widt h = 72
IDColStyle.Read Only = True
IDColStyle.Head erText = mIDCol.Caption
TableStyle.Grid ColumnStyles.Ad d(IDColStyle) dgdInput.TableS tyles.Add(Table Style)
dgdInput.DataSo urce = mInputTable This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris |
last post by:
I'm having trouble Serializing a System.Data.DataColumn
object. When I try to serialize it, I get the following:
System.NotSupportedException: Cannot serialize member
System.ComponentModel.MarshalByValueComponent.Site of
type System.ComponentModel.ISite because it is an
interface.
I tried a number of workarounds without sucess:
|
by: Neil |
last post by:
Hi,
I'm getting some strange results using the autoincrement column on my
datatable. I'm populating a datatable with data from my database and
displaying this in a datagrid. The first time I get the data from the
database I create a new table with an autoincrement column bind the datagrid
to this new table. The auto increment column is displayed as an ID col in the
datagrid. The user can add records or modify records at this point, when...
|
by: Larry Bird |
last post by:
I've created a AlertDataClass below within the class I have tables and column that I've create. In the AlertDataAccess class I'm trying to insert data into my tables. AlertDataAccess is a Module that is trying to insert data into the tables. Within the AlertDataClass is subroutine that init and creates ColumnNames. In invoke the AddDataColumnNames() sub to create the column headers.
Why can't I see the column names in my module that I'm...
|
by: Michael |
last post by:
I am trying to create an access database within Net 2003 using the ADOX
library which works fine except when I try to add the AutoIncrement property
to the ContactId column.
I am experiencing a Property 'item' is ReadOnly error within the below line
.Columns("ContactId").Properties("AutoIncrement") = True
Am I missing a reference or what am I doing wrong?????
|
by: JC Voon |
last post by:
Hi:
How to reset the autoincrement value generated by DataTable ?
I've master and detail table, the detail table has a autoincrement
column, each time i add a new master record, i need to reset the
detail table autoincrement column to start from 1.
I set the dataColumn AutoIncrementSeed=0 and AutoIncrementStep=1 each
time i append a new master row, but it seem not work, it still remain
| |
by: mfunkmann |
last post by:
Hi,
I recently got an error and I don't know how to fix it:
Error 1 'System.Data.DataColumn' does not contain a definition for
'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO
I am note sure what to do because all propertiers work, except the
System.Data.DataColumn..
I didn't write any code by hand and used the visual studio to set the
properties..
|
by: SWIL |
last post by:
Hi,
I made my own datacolumn Class which inherits from Data.DataColumn. To this class I have added 2 properties.
To add datacolumn created through my new class I have to call..
DataSet.Table.Column.Add method
which is a part of datacolumncollection , where the defined data column type is Data.DataColumn and not my custom column.
Thus I have no method to access my datacolumn properties through dataset.
|
by: Tim |
last post by:
Hello All, I could use some help on an error that is just now popping it's
head up.
Seems that the autoincrement numeric has hit 32,767. The autoincrement is
used in various locations in the database, but in this case (log sheets), we
have hit 32k log entries over the past 2 years.
Is there a simple switch to set the autoincrement from integer to long
integer?
|
by: Ryan Liu |
last post by:
I have a program works fine in .NET 1.1 and just recompiled in .NET 2.0
without any code change. Compiles OK, but there is an exeception when
execute it.
Then I remove PK, it works all fine again.
Is this a known bug : PK on auto increase DataColumn in DataTable cause
NullReferenceException?
dcLineId = new DataColumn(LINEID_STR,
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |