|
How can i get the autonumber(primary key value) from the specific rows when i just insert it.
Example
i just insert the member information.
sql="INSERT IMTO register(user,password,address) VALUES (shujuan,841218,singapore)"
so how can i get the primarykey for this row after i just create it.
|
|
|
hi loshshu,
try this technique, good luck :-
<%
Set rs=Server.CreateObject("ADODB.Recordset")
With rs
.Open "TABLE", strConn2, adOpenKeyset, adLockOptimistic, adCmdTableDirect
.Addnew
.Fields("FIELD1")= Request.Form("name")
.Fields("FIELD2")= Request.Form("details")
.Fields("FIELD3")= Request.Form("nature")
.Update
' assume PRIFIELD is autonumber field
intID = .Fields("PRIFIELD")
End With
rs.close
Set rs = Nothing
%>
<Added>
maybe;
you can try visit here http://support.microsoft.com/default.aspx?scid=kb;EN-US;232144
good luck.
|
|
|
|
|
|
|
|
|
|