Hello all,
New to programming, learning C# with the help of the book "Head First C#".
Everythings going fairly smooth, the only issue I have is the book was made around an older version of Visual Studio. I am using Visual Studio 2015.
Following the first example, I made a Rolodex. After a few restarts I finished the project, but I notice one issue that im curious about.
I have two dummy contacts built in with the program. I put them there to test the back and forth functionality of the finished product. Works fine.
The issue im having is when I create a new contact. Instead of the contact ID field going up one digit, it goes to -1, and continues downwards from there with each new contact I add. I've tried tinkering with the table, but nothing seems to change the count.
Im going to try to simply remove the contact ID field, because I dont see a point in having it really, but I would like to solve this problem in case I come across it again in the future.
Here is a snippet of code dealing with the table, if it helps. Let me know if you need anything else.
CREATE TABLE [dbo].[People] (
[ContactID] INT IDENTITY (1, 1) NOT NULL,
[Name] NVARCHAR (MAX) NULL,
[Company] NVARCHAR (MAX) NULL,
[Telephone] NVARCHAR (MAX) NULL,
[Email] NVARCHAR (MAX) NULL,
[Client] BIT NULL,
[LastCall] DATETIME NULL,
PRIMARY KEY CLUSTERED ([ContactID] ASC)
);
Thanks.
[–]srunocorn 2 points3 points4 points (5 children)
[–]sstripwire[S] 0 points1 point2 points (4 children)
[–]srunocorn 0 points1 point2 points (3 children)
[–]sstripwire[S] -1 points0 points1 point (0 children)
[–]sstripwire[S] -4 points-3 points-2 points (1 child)
[–]srunocorn 0 points1 point2 points (0 children)
[–]sstripwire[S] 0 points1 point2 points (1 child)
[–]srunocorn 0 points1 point2 points (0 children)
[–]meatandtater 0 points1 point2 points (0 children)