Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
CREATE TABLE [dbo].[Customers] (
[Customer_ID] [int] IDENTITY (1, 1) NOT NULL ,
[FName] [varchar] (50),
[LName] [varchar] (50)
)
CREATE PROCEDURE AddCustomer
(
@FName varchar(50),
@LName varchar(50),
@CID int OUTPUT
) AS
SET NOCOUNT ON
INSERT INTO Customers
(FName, LName)
VALUES (@FName, @LName)
SELECT @CID = IDENT_CURRENT('Customers')
GO
declare @ret int
Exec AddCustomer 'Steve', 'Smith', @ret output
print @ret
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CustomerDatabaseConnectionString %>"
SelectCommand="Select FName, LName from Complaints" InsertCommandType="StoredProcedure">
InsertCommand="AddCustomer"
<InsertParameters>
<asp:Parameter Name="FName" Type="String" />
<asp:Parameter Name="LName" Type="String" />
<asp:Parameter Direction="Output" Name="CID" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
Protected Sub SqlDataSource1_Inserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Inserted
'Parameter needs a @ before it
Dim sCID As String = e.Command.Parameters("@CID").Value.ToString()
'Here you can assign it to any variable. Even a label.
Label2.Text = sCID
End Sub
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
DataSourceID="SqlDataSource1" Height="172px" Width="304px" DefaultMode="Insert">
<Fields>
<asp:BoundField DataField="FName" HeaderText="FName" SortExpression="FName" />
<asp:BoundField DataField="LName" HeaderText="LName" SortExpression="LName" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
</asp:DetailsView>