Knowledge Base
How Do I Use Tokens in A Select/Submit Command?
Last Post 07 Jun 2010 09:45 AM by DNNDev Admin. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
DNNDev AdminUser is Offline
Posts:6310
Avatar

--
07 Jun 2010 09:45 AM  
What is the syntax for using a user token in an insert statement. The following doesn't work.

<SubmitCommand CommandText="INSERT INTO [goal_tracker] ([title], [description], [type], [targetDate], [isAchieved], [userId]) VALUES(@title, @description, @type, @targetDate, @isAchieved, [[User:ID]]) " />


Use the SubmitCommand's (or SelectCommand's) child tag: <Parameter> and set the value of the parameter to your token:

<SubmitCommand CommandText="INSERT INTO [goal_tracker] ([title], [description], [type], [targetDate], [isAchieved], [userId]) VALUES(@title, @description, @type, @targetDate, @isAchieved, @UserId) " >
<Parameter Name="UserId" Value='[[User:ID]]' />
</SubmitCommand>
Power Your Website With XMod Pro
Buy XMod Pro Today
You are not authorized to post a reply.

Active Forums 4.1
spacer
dummy