Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

inserting record

New Here ,
Feb 22, 2007 Feb 22, 2007

Copy link to clipboard

Copied

when i insert a record from a form into a database i want to go directly to an edit form to edit the rest of my profile but im just getting an error how can i do this. i think i need to pass an id parameter but an insert record does not give me this option how go i do it.

TOPICS
Server side applications

Views

275
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 22, 2007 Feb 22, 2007

Copy link to clipboard

Copied

You have to be able to pull the ID out of the database of the record that
was just inserted. The Insert Record behavior doesn't do that. You either
have to hand code it to grab that ID and create a session variable or assign
the value to a variable.

There are a couple of extension that I know of that do the work for you. I
don't know which server model you are using, but Tom Muck has one at
http://www.tom-muck.com for most server models and there is an ASP only one
at http://www.ultrasuite.com. Both are commercial extensions.


--
Nancy Gill
Adobe Community Expert
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner''s
Guide, Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development

"rob dalton" <webforumsuser@macromedia.com> wrote in message
news:erkrrk$6p8$1@forums.macromedia.com...
> when i insert a record from a form into a database i want to go directly
> to an
> edit form to edit the rest of my profile but im just getting an error how
> can i
> do this. i think i need to pass an id parameter but an insert record does
> not
> give me this option how go i do it.
>
>
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 22, 2007 Feb 22, 2007

Copy link to clipboard

Copied

is there any way i can do it without these extensions in dreamweaver id like to know the code mysel. ive used tom muck horizontal repeat region and it didnt work too well my pages were throwing back errors id like to know the code for the things im creating.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 23, 2007 Feb 23, 2007

Copy link to clipboard

Copied

LATEST
> id like to know the code mysel

Absolutely yes. IMO the behaviors are great starting points but
limited. One method I used when starting db work was to view a page
before I applied a behavior and then review the page afterwards to see
where the code went. Yesterday I used the ASP insert behavior and then
edited the to pass the new identity (MSSQL identity field) to another
form. It sounds like you need something similar. My process is shown
below.

1) Add varuable declaration in the 'execute the insert' section

Dim NewIdent

2) Add to the end of CommandText

before
MM_editCmd.CommandText = "INSERT INTO dbo.Certificates
(Approved_Dt, Status, Street_No, Street_Name, Address_Line_2, City,
[State], ZIP, Home_Phone) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"

statement prefix
SET NOCOUNT ON

statement suffix
SELECT @@IDENTITY AS NewNo SET NOCOUNT OFF

after
MM_editCmd.CommandText = "SET NOCOUNT ON INSERT INTO
dbo.Certificates (Approved_Dt, Status, Street_No, Street_Name,
Address_Line_2, City, [State], ZIP, Home_Phone) VALUES (?, ?, ?, ?, ?,
?, ?, ?, ?) SELECT @@IDENTITY AS NewNo SET NOCOUNT OFF"

3) Change query execute command

before
MM_editCmd.Execute

added code
set rsbc_id =

after
set rsbc_id = MM_editCmd.Execute

4) Added code between query execute and close

added
if not rsbc_id.eof then
NewIdent = rsbc_id.Fields.Item("NewNo").value
end if

5) Change redirect url code

before
MM_editRedirectUrl = "a_m_addmember.asp"

added code
?newid=" & cstr(NewIdent)

after
MM_editRedirectUrl = "a_m_addmember.asp?newid=" &
cstr(NewIdent)

--

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines