Go4Expert

Go4Expert (http://www.go4expert.com/)
-   ASP.NET (http://www.go4expert.com/forums/asp-net/)
-   -   Difference Between Add() and AddWithValue() in ASP.NET,STORED PROCEDURE (http://www.go4expert.com/forums/difference-add-addwithvalue-t20036/)

shyam_oec 9Nov2009 22:03

Difference Between Add() and AddWithValue() in ASP.NET,STORED PROCEDURE
 
hi,
please explain me what is the main difference between Parameters.Add() method and Parameters.AddWithValue() mathod while using StoredProcedure in ASP.NET using C#.I am using Oracle database.as both of them is used to insert value into database.
thanks

urstop 19Nov2009 21:21

Re: Difference Between Add() and AddWithValue() in ASP.NET,STORED PROCEDURE
 
You can use any of the methods to add a parameter along with its value, but Add is deprecated because it has a similar overloaded method. So when using Add, you will have to be careful to make sure that the compiler understands that it is a value and not a SQLDBType. So its always better to use AddWithValue method. Check out this link from MSDN for reference.

http://msdn.microsoft.com/en-us/libr...withvalue.aspx


All times are GMT +5.5. The time now is 14:44.