Getting The Value Of An UpdateParameter

Sep 26, 2007

Hi,
I have a SqlDataSource with UpdateParameters and am trying to get their values.
I tried something like this:
   cmd.Parameters.Add("ProjectManagerID", SqlDbType.Int).Value = CType(SqlDataSource1.UpdateParameters("ProjectManagerID").ToString, Int32)
cmd.Parameters.Add("RequestedBy", SqlDbType.VarChar).Value = SqlDataSource1.UpdateParameters("RequestedBy").ToString
cmd.Parameters.Add("DateRequested", SqlDbType.DateTime).Value = CType(SqlDataSource1.UpdateParameters("DateRequested").ToString, DateTime) 
but that's obviously not right.
I'm trying to do something like:
   cmd.Parameters.Add("ProjectManagerID", SqlDbType.Int).Value = CType(SqlDataSource1.UpdateParameters("ProjectManagerID").Value.ToString, Int32)
cmd.Parameters.Add("RequestedBy", SqlDbType.VarChar).Value = SqlDataSource1.UpdateParameters("RequestedBy").Value.ToString
cmd.Parameters.Add("DateRequested", SqlDbType.DateTime).Value = CType(SqlDataSource1.UpdateParameters("DateRequested").Value.ToString, DateTime) 
(if there were a method called 'Value' for UpdateParameter)
 
Any ideas?
 
Thanks.
 

View 1 Replies


ADVERTISEMENT

UpdateParameter Dynamic Default Value Using &<% .. %&> ?

Aug 16, 2006

<asp:SqlDataSource ID="srcUser" SelectCommand="..." ConnectionString="..." UpdateCommand="Admin_resetAccountStatus" UpdateCommandType="StoredProcedure">    <UpdateParameters>        <asp:Parameter Name="SomeFormData" Type="String" />        <asp:Parameter Name="NTID" Type="String"             DefaultValue="<% =User.Identity.Name %>" />        </UpdateParameters></asp:SqlDataSource>I have this SQLDataSource defined, with some update parameters passing form data to a stored procedure.  For auditing purpose, I also need to pass current user ID, which is User.Identity.Name.  However, the DefaultValue takes <% =User.Identity.Name %> literally.How can I pass parameter value using <% ... %> WITHOUT writing any code behind page?Thanks.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved