to Vince (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Guest -> to Vince (3/15/2001 23:42:00)

RS.Open tableName, yourAlreadyOpenConnection, adOpenKeySet, adLockOptimistic, adCmdTable
RS.AddNew
RS("field1") = value1
RS("field2") = value2
...
RS("fieldN") = valueN
RS.Update
idOfAddedRecord = RS("nameOfAutonumberField")


....
what goes in ("nameOfAutonumberField"), is that a default name for a just added record?????





Vince from Spain -> RE: to Vince (3/15/2001 13:01:00)

No, this is whatever you have called your autonumber field in your access database. Something like "ID" or "CustomerID" or whatever.

Vince

------------------
Internet Business Solutions S.L.(Spain)





Guest -> RE: to Vince (3/15/2001 13:26:00)

but it didn't print the id at all, let alone the id of just added record.

here is what i did:
....
RS("source") = source
RS("realdatesubmit") = Date
myDate=DateValue(spot_impact_mo & "/" & "1" & "/" & spot_impact_yr)
RS("datesubmit") = myDate
RS.Update

idOfAddedRecord = RS("ID")

Response.Write "<strong>SPOT</strong> -"
Response.Write "ID: " & idOfAddedRecord & "<br>"





Vince from Spain -> RE: to Vince (3/16/2001 20:20:00)

If you manually examine the database after the insert, is the new record there? Has the ID field got a value in it? I just want to check that the ID field is in fact an "autonumber" field.
I have used this method on a number of occasions. It does work. Trust me

------------------
Internet Business Solutions S.L.(Spain)





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875