如何在一个不同的页面中存储一个人的详细信息 [英] how the store the details of a person in a single of different pages

查看:68
本文介绍了如何在一个不同的页面中存储一个人的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个页面中,我保存了学生的详细信息,在第二页中,我必须存储该人员的额外详细信息,如何将所有详细信息保存在一行中。

in one page i have saved the details of an student and in second page i have to store the extra details of that person how it is possible all the details should be saved in one row only.

推荐答案

您将在第一页创建记录。创建后,将记录密钥从数据库返回到应用程序。此键应在第二页中用于更新现有记录。
You will create the record in first page. After creating, return the record key to the application from database. This key should be used in second page to just update the existing record.


可以根据id分享我如何更新的代码
can u share me the code how to update based on the id


更改存储过程并从中返回新插入的记录。如果您的表使用身份使用:

Change your stored procedure and return the newly inserted record from it. If your table uses identity use:
Create Procedure InsertDetails
(
@name varchar(50),
@telephone varchar(15)
)
AS
BEGIN
insert into YourTableName
values
@name, @telephone
select scope_identity() as result
END



如果您手动传递记录ID,请使用:


if you are passing record id manually use:

Create Procedure InsertDetails
(
@id varchar(10),
@name varchar(50),
@telephone varchar(15)
)
AS
BEGIN
insert into YourTableName
values
@name, @telephone
select @id as result
END





现在,在你的代码中使用:



Now, in your code behind use:

string _userID = com.ExecuteScalar().ToString();



此后使用:


After this use either:

Response.Redirect("UpdateDetails.aspx?id="_userID);






or

Session["userID"] = _userID;
Response.Redirect("UpdateDetails.aspx")

< br $>


在UpdateDetails.aspx上,从session或querystring获取用户ID。现在,您可以使用用户ID更新详细信息。



On UpdateDetails.aspx get the user id either from session or querystring. Now you can update the details using the user id.


这篇关于如何在一个不同的页面中存储一个人的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆