
March 17th, 2000, 02:03 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,578
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : Mike B (mikeb811@hotmail.com)</b></i><br />Paul,<br /><br />Here is how I did that for a registration database.<br /><br /><%<br />'Code to set up database and open<br />' use OLE DB provider<br /><br />' first add the record it there is any<br />datenow = now() ' used to get exact timestamp entry was made<br />strSQL = "INSERT INTO Students (LastName, FirstName, RegDate) VALUES ('"<br />strSQL = strSQL & request("lname") & "','" & request("fname") & "', #" & datenow & "#);"<br />objCmd.CommandText = strSQL<br />objCmd.CommandType = adCmdText<br />objCmd.ActiveConnection = conn<br />set rscnt = objCmd.execute()<br /><br />' get the student id<br />strSQL = "SELECT * FROM Students WHERE ((LastName='" & request("lname") & "') AND "<br />strSQL = strSQL & "(FirstName='" & request("fname") & "') AND "<br />strSQL = strSQL & "(RegDate=#" & datenow & "#));"<br />objCmd.CommandText = strSQL<br />set rscnt = objCmd.execute()<br />%><br /><br />Hope this helps. If you need more info, just email me.<br /><br />Mike<br /><br /><br /><br />------------<br />Paul at 3/17/2000 3:51:10 AM<br /><br />Does anyone know how to return an Access autonumber to the user after they <br />have insereted their details using a SQL string and ASP?<br /><br />I need this autonumber as a foreign key to insert more information into a different table.<br /><br />Thanks <br /><br />Paul Wilson<br /><br />
|