Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 27th, 2007, 05:15 AM
Registered User
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Regarding auto increment of id

I currently working asp.net with c# and inserting data from webpage into sqlserver 2000 data table.

I have an auto increment ID in a table. Let's say 10 are inserted.

Then you delete those 10.

You add another and the auto increment sets the id at 11.

How can I get that table to start back to 0?

Plz help me and give code for increment id programmatically using c#.

Thanks in Adv,

Old June 27th, 2007, 05:35 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

Use: TRUNCATE TABLE [tablename] instead of DELETE this will reset your Auto Inc fields *BUT* it will delete ALL data from your table, period.

You can not do TRUNCATE TABLE where [field] = value

This is an all or nothing command so be careful with it.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
================================================== =========
Why can't Programmers, program??
================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto increment prad_a MySQL 3 April 7th, 2007 05:47 AM
How To insert auto increment ID to other table ibrhaim ASP.NET 1.0 and 1.1 Professional 4 December 8th, 2006 02:26 PM
How to insert 2 tables with same auto increment ID ibrhaim ASP.NET 1.0 and 1.1 Basics 1 December 7th, 2006 05:00 PM
How to auto increment ? Shawn Mohan SQL Server 2000 2 June 22nd, 2006 03:00 AM
How to auto increment? Shawn Mohan ASP.NET 2.0 Basics 6 June 20th, 2006 10:36 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.