Join our DNN Community    (Newsletter, Tips, Tricks and Forums for DNN Skins & Modules)

 


 
Microsoft Gold Certified Partner - DNN Benefactor

DotNetNuke Powered! 


Monday, December 01, 2008 Register · Login · Contact · Search:  
Company Solutions Portfolio Contact
Forums
General
The ever-powerful ListX module forum. Post your questions, new configuration ideas and reviews.
Subject: Adding User Name on Insert

You are not authorized to post a reply.   
Author Messages
jefboo
Featherweight
Posts:8

10/05/2008 8:04 PM Alert 
Forgive me if this is an easy one to solve. I am fairly knew to ListX. Just got it 2 days ago. I am trying to insert the current logged in Display Name to the database when I insert a record. I am trying to do by using a Querystring tied to the Displayname token. Am I going about this all wrong.
pauldes
Immortal
Posts:1392

10/06/2008 9:32 AM Alert 
Update tablea set displayname = [UserInfo.DisplayName,System]

or [UserInfo.FirstName,System] + ' ' + [UserInfo.LastName,System] if you want the person's real name all the time.

ListX....makes you look brilliant, even though you're not.
jefboo
Featherweight
Posts:8

10/06/2008 8:20 PM Alert 
pauldes,

thanks for the reply. This isn't working for some reason. This is my sql script which is setup as an Action:Execute in the Actions Properties of the Listx form.

IF EXISTS (SELECT * FROM ht_specialties WHERE Spec_ID = @SpecialtyID)

UPDATE ht_specialties
SET Spec_Descr = @SpecialtyName,
Modified_User = [UserInfo.DisplayName,System],
Modified_Date_Time = CONVERT(VARCHAR(30),GETDATE(), 101))
WHERE Spec_ID=@SpecialtyID

ELSE

INSERT INTO ht_specialties
(Spec_Descr, Modified_User, Modified_Date_Time)
VALUES
(@SpecialtyName, [UserInfo.DisplayName,System],
CONVERT(VARCHAR(30),GETDATE(), 101))

If I take out the [UserInfo.DisplayName,System] and just allow a Null to populate it works otherwise nothing. Is there any other suggestions.
VarunC
Cruiserweight
Posts:117

10/07/2008 1:15 AM Alert 
I believe .. you should place SINGLE quotes around your [UserInfo.DisplayName,System] call ....

IF EXISTS (SELECT * FROM ht_specialties WHERE Spec_ID = @SpecialtyID)

UPDATE ht_specialties
SET Spec_Descr = @SpecialtyName,
Modified_User = '[UserInfo.DisplayName,System]',
Modified_Date_Time = CONVERT(VARCHAR(30),GETDATE(), 101))
WHERE Spec_ID=@SpecialtyID

ELSE

INSERT INTO ht_specialties
(Spec_Descr, Modified_User, Modified_Date_Time)
VALUES
(@SpecialtyName, '[UserInfo.DisplayName,System]',
CONVERT(VARCHAR(30),GETDATE(), 101))

It should work now !
jefboo
Featherweight
Posts:8

10/08/2008 7:38 PM Alert 
Again Thank you for the reply. Although this still does not work with this change.

Am I going about this all wrong. This is set up as an action which is defined as an Execute Query action when it saves the data either inserted or modified. If I take out just the Display name from the query it will input the data just fine, so I don't think it is the query itsel. I have tried various other things, but still no dice. Again any help would be appreciated. Getting a little frustrated on what looks to be an easy function.
svedire
Cruiserweight
Posts:107

10/10/2008 9:24 AM Alert 
Hi,

Do you have the same problem even if you try to put in [UserInfo.FirstName] + '' + [UserInfo.LastName,System] instead of [UserInfo.DisplayName,System]?

Thanks,
Sindura
jefboo
Featherweight
Posts:8

10/10/2008 1:23 PM Alert 
Sindura,

Thanks for the reply, I actually got this fixed. And forgot to update this post.

Utilizing [UserInfo.DisplayName,System] was incorrect, it should be

Modified_User = '[UserInfo.FullName,System]'.

I also found that utilizing the standard SQL syntax for date CONVERT(VARCHAR(30),GETDATE(), 101)) was incorrect also. I modified it to be

Modified_Date_Time = '[FORMAT, [DATE,System], {0:d}]'.

Again thanks to all for the help.
You are not authorized to post a reply.
Forums > Bi4ce.Modules.ListX > General > Adding User Name on Insert



ActiveForums 3.6
Latest Post
 
At R2integrated (formerly Bi4ce), we take support seriously.  That's why we support our customers and DNN community with daily monitoring from our experienced engineering team.  We ask that the first step taken is to read the relevant documentation and support forums prior to submitting any questions that may already be available or have been answered.  We ask that you review the documentation that we provide for our products before posting a question.

The Forums are for our customers to chat, exchange ideas and strategies, and submit feedback.  Please be sure to perform keyword searches for previous related forum responses.

To be helpful when submitting a new item, please include the following: 
  1. DNN Version
  2. Module Version
  3. Admin Log Viewer Information
  4. Environment detail: Operating system, .NET framework version, database and version, IIS version, Browser version (if appropriate)
We always try to respond quickly and monitor the forums daily during business hours (EST).  Occasionally, requests for a specific project requirement may not apply for the free support offered. For project specific support please submit via our Information Request form.

Thank you for using our Forums.

Click here to register for the Forums
 
© 2008 by R2integrated (formerly Bi4ce) | DNN® is a registered trademark of DotNetNuke Corporation