.NET Parameter Direction affects datatype casting

Discussion in 'ASP .Net' started by Davide, Oct 30, 2003.

  1. Davide

    Davide Guest

    Hi

    We have a stored procedure for inserting data into a
    table and another for Updating that table.

    For the Insert SP we use a LastModifiedDateTime output
    parameter and for the Update SP we use the InputOutput
    parameter direction.

    When we execute the query the following line works for
    the Insert:
    _lastModifiedDateTime = (DateTime)cmdToExecute.Parameter­
    e;

    But for the execution for the Update we need to use:
    _lastModifiedDateTime = (sqlDatetime)cmdToExecute.Parame­
    e;

    When checking the datavalue we have noticed that if we
    use input or inputoutput as the parameter direction it
    returns sqlDateTime as the datatye but when we use the
    Ouput parameter direction it returns DateTime as the
    datatype.

    The lines we use are:
    cmdToExecute.Parameters.Add(new ­ SqlParameter
    ("@daLastModifiedDat­ eTime", SqlDbType.DateTime, 8,
    ParameterDirection.InputOutput, ­ true, 23, 3, "",
    DataRowVersion.Proposed, _lastModifiedDateTime));

    cmdToExecute.Parameters.Add(new ­ SqlParameter
    ("@daLastModifiedDat­ eTime", SqlDbType.DateTime, 8,
    ParameterDirection.Output, true, 23, 3, "",
    DataRowVersion.Proposed, _lastModifiedDateTime));

    Is this the correct behaviour?
    Is there something I am missing from
    cmdToExecute.Parameters statments?
     
    Davide, Oct 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?anVubGlh?=
    Replies:
    2
    Views:
    582
    =?Utf-8?B?anVubGlh?=
    May 20, 2005
  2. kevin
    Replies:
    11
    Views:
    5,816
    Andrew McDonagh
    Jan 8, 2005
  3. Jeff
    Replies:
    2
    Views:
    1,171
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 16, 2007
  4. Wally Barnes
    Replies:
    3
    Views:
    533
    Wally Barnes
    Nov 20, 2008
  5. Sosuke

    Up casting and down casting

    Sosuke, Dec 20, 2009, in forum: C++
    Replies:
    2
    Views:
    577
    James Kanze
    Dec 20, 2009
Loading...

Share This Page