简体   繁体   English

将信息从一个网页插入到两个不同的表

[英]Inserting information from one webpage to two different tables

I am working in asp.net and i have a User page with text boxes and submit button. 我在asp.net中工作,我有一个带有文本框和提交按钮的用户页面。 When a user enters information to text boxes and press the button, the information is added to sql server database User table. 当用户在文本框中输入信息并按下按钮时,该信息将添加到sql server数据库的User表中。 After adding the information to database, the user is redirected to another page( Response. Redirect() ), where the user is asked to chose the information from drop down menu and click button. 将信息添加到数据库后,将用户重定向到另一个页面( Response. Redirect() ),在该页面中,要求用户从下拉菜单中选择信息,然后单击按钮。 After button is clicked i want to add the information from drop down to another table(WorkShop) but i need also some information from text boxes on the User Page to be added to Work shop table. 单击按钮后,我想将信息从下拉列表添加到另一个表(WorkShop)中,但是我还需要用户页面上文本框中的一些信息才能添加到Work shop表中。 Can any body help me? 有谁能够帮助我? Thank you 谢谢

You should use Session State to keep your records even if you use response.redirect. 即使使用response.redirect,也应使用会话状态保留记录。 I suggest you to look Session State . 我建议你看看会话状态 Here is a sample code for Session. 这是会话的示例代码。 You can reach from every page to this values by using session state. 您可以使用会话状态从每个页面到达此值。 But it only works if you use user sessions!. 但是它仅在使用用户会话时才有效! Another way to transfer a data from pages is to use querystring. 从页面传输数据的另一种方法是使用查询字符串。 Try to look at Querystring ASP.NET 尝试看看Querystring ASP.NET

Session["FirstName"] = FirstNameTextBox.Text;
Session["LastName"] = LastNameTextBox.Text;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM