title: asp.net sql query - bind the default value of a parameter to the return value of a method from code behind
body: <pre><code> &lt;asp:Parameter Name="Creator_Id" Type="Int32"  DefaultValue="&lt;%=currentEmployeeId() %&gt;"/&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>INSERT INTO [PromotionSet] ([StartDate], [EndDate], [Bonus], [Text], [InfoImage], [RequiresPreregistration], [Code], [Creator_Id]) VALUES (@StartDate, @EndDate, @Bonus, @Text, @InfoImage, @RequiresPreregistration, @Code,&lt;%=currentEmployeeId() %&gt;"
  </code></pre>
  
  <p>Neither of the above means of achieving the same thing work.
   currentEmployeeId returns the id of the current logged in user.
  If currentEmployeeId is set to return simply "1"(return "1"). it still doesn't work.
  But if I replace &lt;%=currentEmployeeId() %> by 1 it works.</p>
  
  <p>Doesn't inline code work in this scenarios? How should I accomplish this?</p>
  
  <p>Object data source is out of the question-I don't have time to write the insert update and delete methods myself(This is why I use SQLDataSource)</p>
  
  <p>Many thanks</p>