存储过程:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE spInsertData
@UNAME varchar(20),
@Pass varchar(20),
@Active bit,
@City nvarchar(20),
@Phone nvarchar(10)
AS
BEGIN
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO Login
VALUES(@UNAME, @Pass, @Active, @City, @Phone)
SELECT SCOPE_IDENTITY() AS Id
END
GO
C#代码隐藏:
namespace AjaxJqueryDemo
{
public partial class Reg : System.Web.UI.Page
{
TraineeEntities DB = new TraineeEntities();
protected void btnReg_Click(object sender, EventArgs e)
{
int i = DB.spInsertData(uname.Text, Pass.Text,true, city.Text, pHno.Text);
}
}
}
如何获取范围标识以便我可以确保插入数据?
我没有使用gridview,我也不想使用它。我怎么能够 简单地取一下?
请给出更详细解释的答案,以便我能理解..
答案 0 :(得分:2)
请检查以下代码,它会给你更好的建议。
public interface IAuthenticationSessionStore
{
Task RemoveAsync(string key);
Task RenewAsync(string key, AuthenticationTicket ticket);
Task<AuthenticationTicket> RetrieveAsync(string key);
Task<string> StoreAsync(AuthenticationTicket ticket);
}