Print Page | Close Window

Adding New Records.

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=11210
Printed Date: 28 March 2026 at 9:03am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Adding New Records.
Posted By: davidshq
Subject: Adding New Records.
Date Posted: 16 July 2004 at 10:47am

I'm to the Add New Records page now...And I am having a bit of a problem. My records look likes follows:
ID (unique identifier)
mMonth (event month)
mDay (event day)
mYear (event year)
mEvent (event description)
It is quite simple for me to take the text from the user's input in text boxes and assign it to each of these values, but I haven't created and don't want to create an ID textbox. Rather, I want the ID to auto-incremement. Does anyone know how to do that in ASP.NET?
So, what I need is for the script to realize that the database already has 567 records and thus to automatically label the ID as 568.
Respectfully,
David.



-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Replies:
Posted By: Mart
Date Posted: 16 July 2004 at 10:50am

You don't need to worry about that, as long as you set the data type to autonumber in access or used IDENTITY INCREMENT in SQL Server it will be done automatically, you just don't use it in the query i.e.

INSERT INTO [table] VALUES ('Month', 'Day', 'Year', 'Event')

btw Why don't use have a mDate field with DataType DateTime instead of having three differant fields?



Posted By: davidshq
Date Posted: 16 July 2004 at 11:14am
Thanks Mart. :-) Hmmm...thats a good question. I think because I never learned about it. I'm afraid I'm still starting off with all this. I read about it a while back, but this is my first real application since I wrote it in ASP. Other than that, once Web Matrix makes a database and you enter info. into it, it can't work with the structure anymore...just the contents.
Respectfully,
David.

-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net