Retrieving Data from a Stored Procedure : Stored Procedure SqlConnection « ADO.net Database « ASP.Net

Home
ASP.Net
1.ADO.net Database
2.Ajax
3.Asp Control
4.Collections
5.Components
6.Data Binding
7.Development
8.File Directory
9.HTML Control
10.Language Basics
11.Login Security
12.Mobile Control
13.Network
14.Page
15.Request
16.Response
17.Server
18.Session Cookie
19.Sitemap
20.Theme Style
21.User Control and Master Page
22.Validation by Control
23.Validation by Function
24.WebPart
25.WPF
26.XML
ASP.Net » ADO.net Database » Stored Procedure SqlConnection 
Retrieving Data from a Stored Procedure

<%--
ASP.NET Tips & Techniques (Paperback)
by Greg Buczek 

Publisher: McGraw-Hill/Osborne Media; 1st edition (May 212002)
Language: English
ISBN: 0072225149
--%>          
       
<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SQLClient" %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
    Dim DBConn as SQLConnection
    Dim DBCommand As SQLDataAdapter
    Dim DSPageData as New DataSet
    DBConn = New SQLConnection("server=localhost;" _
        "Initial Catalog=TT;" _
        "User Id=sa;" _
        "Password=yourpassword;")
    DBCommand = New SQLDataAdapter _
        ("Exec CurrentMonthBirthDays", DBConn)
    DBCommand.Fill(DSPageData, _
        "Emps")
    dgEmps.DataSource = _
        DSPageData.Tables("Emps").DefaultView
    dgEmps.DataBind()
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Retrieving Data from a Stored Procedure</TITLE>
</HEAD>
<Body LEFTMARGIN="40">
<form runat="server">
<BR><BR>
<asp:datagrid
    id="dgEmps" 
    runat="server" 
    autogeneratecolumns="True"
>
</asp:datagrid>
</form>
</BODY>
</HTML>
           
       
Related examples in the same category
1.Call store procedure
2.Call store procedure through SqlConnection
3.Using Stored Procedures
4.Use stored procedure to insert data
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.