Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Creating the ID Value

Questions related to using nuBuilder Forte.
Post Reply
thharris
Posts: 2
Joined: Mon Apr 11, 2022 9:27 pm

Creating the ID Value

Unread post 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
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Creating the ID Value

Unread post 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.
thharris
Posts: 2
Joined: Mon Apr 11, 2022 9:27 pm

Re: Creating the ID Value

Unread post 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
nac
Posts: 115
Joined: Tue Dec 12, 2017 11:28 pm
Location: Aberdeen, UK
Has thanked: 9 times
Been thanked: 12 times

Re: Creating the ID Value

Unread post 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
Post Reply