| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Calling Stored Procedures from Visual Studio 1

Page history last edited by Christopher Cole 10 years, 1 month ago

 

 

Calling Stored Procedures from Visual Studio

 

Demonstrates using Visual tools how to call a SQL Server stored procedure from Visual Studio

 

Summary

 

Topics Covered in this Video;

 

-SQLDataSource
-Configure select statement
-Defining Parameters
-DataSourceSelectArguments
-Populating database
-Setting events to buttons

 

Video

 

http://online1.daytonastate.edu/player2.php?id=6048ff4e8cb07aa60b6777b6f7384d52 

 

 

Code

 

 protected void btnSubmit_Click(object sender, EventArgs e)
        {
            SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            tbFirst.Text = string.Empty;
            tbLast.Text = string.Empty;
        } 
<body>
    <form id="form1" runat="server">
    <div>
    First Name 
        <asp:TextBox ID="tbFirst" runat="server"></asp:TextBox><br />
    Last Name
        <asp:TextBox ID="tbLast" runat="server"></asp:TextBox><br />
    </div>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
        onclick="btnSubmit_Click" />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:RegistrationDatabaseConnectionString %>" 
        SelectCommand="SP_addStudent" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="tbFirst" Name="FirstName" PropertyName="Text" 
                Type="String" />
            <asp:ControlParameter ControlID="tbLast" Name="LastName" PropertyName="Text" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    </form>
</body> 

 

Resources for Objects Used

 

SqlDataSource - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.select.aspx 

 

TextBox - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.aspx 

 

Button - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.aspx 

Comments (0)

You don't have permission to comment on this page.