ARTICLE

How do I Execute Stored Procedures and Views?

Posted by Praveen Kumar Articles | Visual Basic 2010 November 16, 2004
This article explains that how we can execute stored procedures and views.You can execute stored procedures and views using three execute methods of SqlCommand object.
 
Reader Level:

You can execute stored procedures and views using three execute methods (ExecuteNonQuery, ExecuteReader, and ExecuteScalar) methods of SqlCommand object. Before you call execute method of SqlCommand to execute a stored procedure, you need to set SqlCommand.CommandType property to CommandType.StoredProcedure and SqlCommand.CommandText as stored procedure name.

Private cmd As SqlCommand = New SqlCommand()
Private cmd.Connection = con
Private cmd.CommandType = CommandType.StoredProcedure
Private cmd.CommandText = "CustOrderHist"

You can also use stored procedure and views in your SELECT statements to retrieve data from stored procedures and views. Instead of a database table name, you use stored procedure or view name.

share this article :
post comment
 

hi sir, please help me.. how to view stored procedure using vb.net or vb 2008?


viewing from textbox?? what is the code?

thanks.. im only a student..

Posted by toto toto Oct 30, 2010
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
MOST LIKED ARTICLE
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor