Hey people stupid one here
I dont think access datbase supports @@Indentity
so there fore i need toknow whats the best way to reteive the recordID that ive just added to the db, i am useing access querys
cheers peps
Carl
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
I am afriad you have to requery the database to know what was the newest record added. I use AutoNumber fields when I just want to have a primarykey, otherwise when it comes to caring for the number of record or such, I use a number field whose value is determined by the code and I know beforehand what I am going to put into it.
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
dont really want to use SQL
i guess theres no fancy way to do this i saw the other day some like select max(recordId) or something like that????
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
Can this be used in VB.Net Application ??? that code looks like normall ASP to me ?
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
I never know this before so I've tried it myself and created a demo that you may have a look at it but it has little bug which is : the result I get all zeros I don't know why . Maybe the syntax is incorrect for the sqlstring . But at least you keep testing on this little buggy progy . . It's VB.NET 2003 with XP Database mdb .
Priate, ive found this in the MSDN Lib
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconretrievingidentityorautonumbervalues.htm
Expains everyting to get your code working correct
I think you need to add or update the table before recovering the identity
If u get your code working can you post it up
Cheers Carl
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
Only thing your fogetting to do is insert or update a record first,
just copy
Dim cmdStr As String = "SELECT @@Identity"
Dim cmdid As New OleDbCommand(cmdStr, MyConnection)
Dim ident As Integer = Int(cmdid.ExecuteScalar())
MsgBox("New Ident is: " & ident)
into any project where your inserting or update just after the commit
it will return the correct value
cheers for the help buddy
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message