简体   繁体   中英

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. When a user enters information to text boxes and press the button, the information is added to sql server database User table. 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. 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. Can any body help me? Thank you

You should use Session State to keep your records even if you use 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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