generating CustomerID
-
int n = int.Parse(CustomerID[CustomerID.Length - 1].CustomerID.Substring(4, 3)) + 1; i try this to generate customer ID but kept telling me the is clash with surburbID becouse i linked surburb in customer table
Dear Kolisa, have you tried something like that: int currentMax = CustomerID.Max(customer => int.Parse(CustomerID.Substring(4, 3)))+1; I assume you use c# as your choosen language in version 3.x. If not, pls specifiy your problem in more detail. Besides, i suggest to give your variables more distinguished names. Have an array with name CustomerID of type CustomerID is a little bit confusing. Also int.Parse on a substring without null checks or length checks is quite dangerous. Regards Jens
When in trouble, when in doubt, run in circles, scream and shout
-
int n = int.Parse(CustomerID[CustomerID.Length - 1].CustomerID.Substring(4, 3)) + 1; i try this to generate customer ID but kept telling me the is clash with surburbID becouse i linked surburb in customer table
You have given very little context. What is surburbID? I assume a foreign key. What does your data structure like? How are you assigning the id? We can't read your mind and we're not working on the same project with you.
I know the language. I've read a book. - _Madmatt