R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
Updating a database with ListX - PLEASE HELP
Last Post 01 Jan 1900 05:00 AM by . 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Informative
leahdugueUser is Offline
New Member
New Member
Posts:7

--
13 Sep 2006 03:25 PM  
I am trying to update a database with ListX.  What  should I do?  So far, this is the code I have in the Header section under Format:

Last Name First Name
Thank you very much!
kevinmschreinerUser is Offline
Advanced Member
Advanced Member
Posts:729

--
14 Sep 2006 10:20 PM  
Okay, so we have two form elements: NewLastName and NewFirstName.

First - add two Variables in the Control panel. Their type is Form, and their names are NewLastName and NewFirstName. Set the Left and Right Padding to single quote ', and set the Empty target to NULL. Also set the Target of the replacement values to @NewLastName and @NewFirstName.

Next, Add a button, or a Link to your page which will submit the data. For the example - lets place a link -
Save

Okay - now - you need to create the Action script to save your data. If you loaded the record from an existing record, you will need that value, but for this example, it appears you desire the ability to INSERT a new record.

1. Add a message action - ACTION:Message with a Type, Toolbar and a Name Save which acts as the listener for our link click.
2. As a child of the Message Action we just added - Add an ACTION:Execute, setting the Name of the execution to NEWRECORD and the Query to your insert statement - for example:

INSERT INTO myTable(FirstName,LastName) VALUES (@NewFirstName,@NewLastName)
SELECT SCOPE_IDENTITY() newID

I assumed that myTable would have a primary key, and I returned that here. If you need to do something with that identity value - you have access to it via the ListX tag [newID,NEWRECORD].

Got it?
leahdugueUser is Offline
New Member
New Member
Posts:7

--
15 Sep 2006 05:14 AM  
Thank you very much!  I really appreciate it. 
Leah
You are not authorized to post a reply.

Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share