Still having problems. If I add the SET NOCOUNT ON, it won't allow me to add a new record!
Diane -----Original Message----- From: Linden, Todd [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 1:30 PM To: [EMAIL PROTECTED] Subject: [wdvltalk] RE: Help getting auto-increment field data in SQL Diane, Try this... Set rsRecord = Server.CreateObject("ADODB.Recordset") strSQL = "SET NOCOUNT ON SELECT * FROM members WHERE File2 = '" & sFile & "'" rsRecord.Open strSQL,cnn,3,3 if type = "new" if rsRecord.EOF then rsRecord.AddNew else error message that we already have this record response.end end if end if ...get data from form fields rsRecord.update myID = rsRecord("ID") I think the myID would then have your new value... HTH, - Todd -----Original Message----- From: Diane Schips [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 5:54 PM To: [EMAIL PROTECTED] Subject: [wdvltalk] RE: Help getting auto-increment field data in SQL Thanks Todd, but this isn't helping I'm afraid. Do I have to do an INSERT INTO? Can I do rsRecord.addnew and then get @@Identity? I've always seem to have trouble with INSERT. In this case however, I have more reason to not use it. I have two forms, and add and an edit. Both have the same fields with the same field names, so I can get the data from either. Each calls the page containing this code: type=request.querystring("t") set cnn=server.CreateObject("adodb.connection") cnn.Open strConn2 Set rsRecord = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT * FROM members WHERE File2 = '" & sFile & "'" rsRecord.Open strSQL,cnn,3,3 if type = "new" if rsRecord.EOF then rsRecord.AddNew ...get identifier else error message that we already have this record response.end end if end if ...get data from form fields rsRecord.update Can I get the identifier using this cide, or do I have to rewrite it? Diane ____ • The WDVL Discussion List from WDVL.COM • ____ To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] Send Your Posts To: [EMAIL PROTECTED] To set a personal password send an email to [EMAIL PROTECTED] with the words: "set WDVLTALK pw=yourpassword" in the body of the email. To change subscription settings to the wdvltalk digest version: http://wdvl.internet.com/WDVL/Forum/#sub ________________ http://www.wdvl.com _______________________ You are currently subscribed to wdvltalk as: [EMAIL PROTECTED] To unsubscribe send a blank email to %%email.unsub%% ____ • The WDVL Discussion List from WDVL.COM • ____ To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] Send Your Posts To: [EMAIL PROTECTED] To set a personal password send an email to [EMAIL PROTECTED] with the words: "set WDVLTALK pw=yourpassword" in the body of the email. To change subscription settings to the wdvltalk digest version: http://wdvl.internet.com/WDVL/Forum/#sub ________________ http://www.wdvl.com _______________________ You are currently subscribed to wdvltalk as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]