Passing a parameter to a stored procedure
-
I have created a stored procedure in MS SQL Server. It worked well there, but I want to call it from my vb application by sending a parameter to get the result from the database. Who can tell me how? Thankz
This shud help http://www.dotnetspider.com/kb/Article1867.aspx[^]
-
I have created a stored procedure in MS SQL Server. It worked well there, but I want to call it from my vb application by sending a parameter to get the result from the database. Who can tell me how? Thankz
Nine_ wrote:
Who can tell me how?
Did you mean: How do I do this? If I answer "Who can tell me how?" then my answer would have to be "I can" - but that is not very helpful to you. Is it? The
SqlCommand
object has aParameters
property. You just need toAdd
your parameters to it. e.g.cmd.Paramters.Add("@SomeParameter", someValue)
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Nine_ wrote:
Who can tell me how?
Did you mean: How do I do this? If I answer "Who can tell me how?" then my answer would have to be "I can" - but that is not very helpful to you. Is it? The
SqlCommand
object has aParameters
property. You just need toAdd
your parameters to it. e.g.cmd.Paramters.Add("@SomeParameter", someValue)
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
I would just like to add, that for .NET 2.0 the
Add
method has been deprecated and the methodAddWithValue
should be used instead (with the same parameters).szukuro wrote:
I would just like to add, that for .NET 2.0 the Add method has been deprecated
That is not entirely true. Only one overload of the Add method has been deprecated. The remaining overloads are acceptable.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
szukuro wrote:
I would just like to add, that for .NET 2.0 the Add method has been deprecated
That is not entirely true. Only one overload of the Add method has been deprecated. The remaining overloads are acceptable.
Upcoming events: * Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website