Page 1 of 1

Creating the ID Value

Posted: Mon Apr 11, 2022 10:47 pm
by thharris
Hello,

I'm using a vb.net program to write values to the database and I'm not sure how I should be creating the "Table ID" values.

Here is an example. I created one row in nuBuilder (1002) and the other with my vb.net program but the test_id is showing blank on the data I entered from a vb.net program (1001).

test_id num text1 text2

" " 1001 test test

625480430e8b516 1002 test test

Any help is very appreciated.
Thanks

Re: Creating the ID Value

Posted: Mon Apr 11, 2022 10:59 pm
by kev1n
Hi,

Your question might be better suited for a vb.net forum (stackoverflow etc.). I did a quick google search and found this code: https://stackoverflow.com/a/64881291/10132321
The ids are not exactly the same as the ones that nuBuilder generates but they should just do the job.

Re: Creating the ID Value

Posted: Mon Apr 11, 2022 11:48 pm
by thharris
Hello Kevin,

I was hoping that I could do it the same way as nuBuilder or if there was some built in way to generate the id's but I guess your right I should just look at this as a .net problem and find another way to code it in.

I ended up using the UUID() sql function to create a value and that seems to be working.

Thanks for your help
Thomas

Re: Creating the ID Value

Posted: Tue Apr 12, 2022 9:15 pm
by nac
hello Thomas,

Back in the day, the good folks at nuBuilder created an MS-Access program to convert data and some application objects from MS-Access. It was called A2N. In it there is a VBA function:

Code: Select all

Function nuID()
    
    nuID = "i" & LCase$(Hex(CLng(Format(Now(), "yymmdd"))) & Hex(CLng(Format(Now(), "hhnnss"))) & Hex(nextID))
    If nextID > 9800 Or nextID = 0 Then
        nextID = 1000
    Else
        nextID = nextID + 1
    End If

End Function
where nextID is a global integer variable. I dare say this could be converted to vb.net quite easily. The prefix could be changed to anything you want.

I hope this helps.

Neil