Hi Fellows,
Well. let me start by higlighting the problem i face.I have two columns namely PID which is the primary key and also a auto number.The second is Serial No. which is also a auto number.

The problem i face is that when i submit my form spcifying a month i want my serial no. to start from one and and end with the number of records in my Datagrid.

IF i come to the same and select a different month the PID should continue from where the last auto no. is but my serial no should start from 1 again..

Is there any option to do like this.Both PID and Serial No. are in the same table.


8 Years
Discussion Span
Last Post by sierrainfo

You can set a trigger on Insert Button as check the month for inserting record and previous record. It both are different then reset Serial No. and then insert.


Click of submit button check the month of previous record and reset the Serial No. and the execute the insert command.


Thanks man,
I just checked it out... Sql wont allow me to have two auto no's.Is there any other option in code to do this and how to reset serial no to one without deleting the data.
I am using vb.net 1.1


I have found another option to do this(via Code).Instead of checking the month while submitting, i have found a way to count the number of rows using the dataset property


It is returning me the number of rows in my datagrid.I will write a for loop and form an ary to start from one and increment it till the last row of datagrid...Thanks for the replies..I hope some one will use this...

Thanks and Regards

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.