Arg81
Well-known member
Hi guys,
I am developing a VB.Net frontend to an SQL 2000 backend database.
I have had no problems with data binding etc, but in my 2 related tables, I have a field called Sequence. In SQL I have set this field to int, and not to auto-increment.
Table1 has a field DWRNo. Table2 also has DWRNo.
DWR001 in table1 could have 5 records matching in table2.
I need the program to auto-sequence the second field in table2, DWR_Sequence.
I.E. when a user adds a new record to the datagrid (master-child setup), it looks at what the DWRNo is, then at what the highest value of DWR_Sequence is matching that DWRNo, and adds 1 to it for the new value, and inserts this value.
I've got a book (Murachs VB.Net database programming) that discusses it, but gives no example on how to do it. Therefore I know it can be done, but I haven't found a clear consise way of doing it.
If anyone can give me some pointers I would be very, very grateful.
Kind Regards,
Luke Argent
I am developing a VB.Net frontend to an SQL 2000 backend database.
I have had no problems with data binding etc, but in my 2 related tables, I have a field called Sequence. In SQL I have set this field to int, and not to auto-increment.
Table1 has a field DWRNo. Table2 also has DWRNo.
DWR001 in table1 could have 5 records matching in table2.
I need the program to auto-sequence the second field in table2, DWR_Sequence.
I.E. when a user adds a new record to the datagrid (master-child setup), it looks at what the DWRNo is, then at what the highest value of DWR_Sequence is matching that DWRNo, and adds 1 to it for the new value, and inserts this value.
I've got a book (Murachs VB.Net database programming) that discusses it, but gives no example on how to do it. Therefore I know it can be done, but I haven't found a clear consise way of doing it.
If anyone can give me some pointers I would be very, very grateful.
Kind Regards,
Luke Argent