codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  asp problem(insert/select statement)  lohshu at 12:55 on Tuesday, September 07, 2004
 

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.

  Re: asp problem(insert/select statement)  Yusairi at 14:03 on Tuesday, September 07, 2004
 

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.
Yusairi: site expert
www.vss.com.my









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: servlet login
•  Re: urgent!Need help please.......
•  Re: MailAttachment
•  Re: Error in Demo
•  Re: asp problem(insert/select statement)
•  Re: urgent!Need help please.......
•  Re: syntax error in insert statement .please help me solve it
•  Re: PLEASE HELP WITH MY SITE!
•  Re: Unseen changes


Recent Articles
Simple Thumbnail Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)
Function to Return Alpha Characters Only
The OSI Reference Model - A Clear and Concise Illustration !


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2004