473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

.NET Parameter Direction affects datatype casting

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*
s@daLastModifiedDateTime.Value;

But for the execution for the Update we need to use:
_lastModifiedDateTime = (sqlDatetime)cmdToExecute.Parame*
te**@daLastModifiedDateTime.Value;

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?
Nov 17 '05 #1
0 1118

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lasse Edsvik | last post by:
Hello I have this: public SqlParameter GetParameter(string sqlparam) { SqlParameter param = cmd.Parameters.Add(sqlparam);
8
by: Yusuf INCEKARA | last post by:
I have a stored procedure : CREATE PROCEDURE STP_GETSTORELIST @RETCUR CURSOR VARYING OUTPUT AS set @RETCUR = CURSOR FORWARD_ONLY STATIC FOR SELECT ID,STORE_NAME FROM T_INF_STORE ORDER BY...
0
by: Frederico Guimar??es via DotNetMonster.com | last post by:
Hi, I'm trying to use the Microsoft.Web.Services2.Messaging. ISoapFormatter but I receive this error: System.Xml.XmlException: Reference to undeclared parameter entity, 'meetingmaker'. at...
8
by: Christopher Weaver | last post by:
I'm having trouble accessing the value of an output parameter of a stored procedure. The SP looks like this: SET TERM ^ ; CREATE PROCEDURE SP_NEW_TASK RETURNS ( "uidTask" INTEGER) AS begin
8
by: Raider | last post by:
I have simple class hierarchy (without multiple inheritance): class Base {}; class Derived : public Base {}; class DeepDerived : public Derived {}; // ... a lot of types Is it ok to cast...
7
by: ashtek | last post by:
Hi, I have a generic function that executes a stored procedure & returns a data table. Code: === public static DataTable ExecuteStoredProcedure(string strProc,SqlParameter paramArray) {...
1
by: interX | last post by:
Hi I'm new in VC++ and have a question to generics. I have a generic class, which contains an array of the generic type. This array I can pin and then I would like to get an unmanaged pointer to...
8
by: =?Utf-8?B?UmF2aQ==?= | last post by:
Hi, I'm trying to pass values of different data-types to a web-service. I thought it would be easier to box these values and pass them as a System.object parameter, like public void...
1
by: John Bailo | last post by:
This is a my solution to getting an Output parameter from a SqlDataSource. I have seen a few scant articles but none of them take it all the way to a solution. Hopefully this will help some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.