Call store procedure : Stored Procedure SqlConnection « ADO.net Database « ASP.Net






Call store procedure

<%@ 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 DBSP As New SQLCommand
    DBConn = New SQLConnection("server=yourhost;" _
        & "Initial Catalog=TT;" _
        & "User Id=sa;" _
        & "Password=yourpassword;")
    DBSP.CommandText = "Exec AddGarbageRecord"
    DBSP.Connection = DBConn
    DBSP.Connection.Open
    DBSP.ExecuteNonQuery()
    lblMessage.Text = "Stored procedure completed."
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Calling a Stored Procedure</TITLE>
</HEAD>
<Body LEFTMARGIN="40">
<form runat="server">
<BR><BR>
<asp:label
    id="lblMessage"
    runat="Server"
/>
</form>
</BODY>
</HTML>
           
       








Related examples in the same category

1.Retrieving Data from a Stored Procedure
2.Call store procedure through SqlConnection
3.Using Stored Procedures
4.Use stored procedure to insert data