I have made a website using asp.net web forms, through website I am storing data in SQL server, having multiple tables in database, they all are joined and created
as a view having relationships also. The problem is when the data is entered through web forms it gets stored at last page but in case if I close the browser in the middle then the data in SQL server(in views) starts overlapping it picks up the previous data
on first page where the browser was closed. I have tried using sessions but it doesn't work.
Please expand on the description of your problem. What do you mean by "it gets stored at last page", and "starts overlapping it picks up previous data on first page"? "Close the browser in the middle" ... in the middle of what? What did you think session
would do to help an SQL data storage problem?
I have 8 webforms where the user enters the data and on each page, the user data get stored in different tables in sql server and all the tables are then combined as view having the relationships. The data is getting stored acurately in each table and in
the view also but when i close the browser in middle then where the browser was closed it catches the previous data on first page. I am not sure if it has something with sessions or sql join.
I'm still not quite sure what you mean. "When I close the browser in the middle" - Do you mean you only go through some of the pages, not all 8?
And: "where the browser was closed it catches the previous data on first page." What do you mean by "catches"? If you are storing data on each of the 8 pages, and you close, for example page 6 without saving it, then the data for pages 1 - 5 will already
have been saved, of course. Is that what you mean? That would be expected behavior.
Please try to share some code so we get better idea of your problem. Without looking at your code it's difficult to understand or troubleshoot your issue.
Yes. when I am storing data on each of the 8 pages, and close, for example page 6 without saving it, then the data for pages 1 - 5 will already have been saved that is working. Each page data is stored
in different tables and then all are combined in one table(view), when data is entered from page 1 to all the way last page 8 it goes properly in the combined table(view) for each customer but if i close browser in between then the data in all tables is going
but when it comes to combination table(view) then itpicks up the value where it was closed and all the data in combination table(views) is not accurate. I dont know what exactly the problem is I am attaching my codes also.
string save = "INSERT INTO ReporterData(Reporter,Ondutyone,Ondutytwo) VALUES (@Reporter,@Ondutyone,@Ondutytwo)";
SqlCommand cmd = new SqlCommand(save, con);
string save = "INSERT INTO Studentdata(Student,Phase,Typeofabsence) VALUES (@Student,@Phase,@Typeofabsence)";
SqlCommand cmd = new SqlCommand(save, con);
Now I want to combine all the data in different tables into 1 table so that if the browser closes in between from any reason . The data entering should start from page 1 and go together in 1row.
Each page data is stored in different tables and then all are combined in one table(view), when data is entered from page 1 to all the way last page 8 it goes properly in the combined table(view) for each customer but if i close browser in between then the
data in all tables is going but when it comes to combination table(view) then itpicks up the value where it was closed and all the data in combination table(views) is not accurate
According to your posted code, I can't reproduce your question.
In your code, You just redirect one page to another and pass the value of the session.
Can you show me how did you combine different tables in one table?
So please post the code that can reproduce your question.
Best regards,
Sam
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
2 Points
5 Posts
Data Overlapping SQL Server Views
Oct 25, 2019 06:44 PM|shubh5506|LINK
I have made a website using asp.net web forms, through website I am storing data in SQL server, having multiple tables in database, they all are joined and created as a view having relationships also. The problem is when the data is entered through web forms it gets stored at last page but in case if I close the browser in the middle then the data in SQL server(in views) starts overlapping it picks up the previous data on first page where the browser was closed. I have tried using sessions but it doesn't work.
Any help will be appreciated.![]()
![]()
Contributor
5961 Points
2466 Posts
Re: Data Overlapping SQL Server Views
Oct 25, 2019 06:56 PM|KathyW|LINK
Please expand on the description of your problem. What do you mean by "it gets stored at last page", and "starts overlapping it picks up previous data on first page"? "Close the browser in the middle" ... in the middle of what? What did you think session would do to help an SQL data storage problem?
Member
2 Points
5 Posts
Re: Data Overlapping SQL Server Views
Oct 25, 2019 07:04 PM|shubh5506|LINK
I have 8 webforms where the user enters the data and on each page, the user data get stored in different tables in sql server and all the tables are then combined as view having the relationships. The data is getting stored acurately in each table and in the view also but when i close the browser in middle then where the browser was closed it catches the previous data on first page. I am not sure if it has something with sessions or sql join.
Contributor
5961 Points
2466 Posts
Re: Data Overlapping SQL Server Views
Oct 26, 2019 12:04 AM|KathyW|LINK
I'm still not quite sure what you mean. "When I close the browser in the middle" - Do you mean you only go through some of the pages, not all 8?
And: "where the browser was closed it catches the previous data on first page." What do you mean by "catches"? If you are storing data on each of the 8 pages, and you close, for example page 6 without saving it, then the data for pages 1 - 5 will already have been saved, of course. Is that what you mean? That would be expected behavior.
Or did you mean something else?
Member
741 Points
220 Posts
Re: Data Overlapping SQL Server Views
Oct 26, 2019 03:22 AM|immayankmodi|LINK
Please try to share some code so we get better idea of your problem. Without looking at your code it's difficult to understand or troubleshoot your issue.
Happy coding!
Member
2 Points
5 Posts
Re: Data Overlapping SQL Server Views
Oct 28, 2019 07:53 PM|shubh5506|LINK
Yes. when I am storing data on each of the 8 pages, and close, for example page 6 without saving it, then the data for pages 1 - 5 will already have been saved that is working. Each page data is stored in different tables and then all are combined in one table(view), when data is entered from page 1 to all the way last page 8 it goes properly in the combined table(view) for each customer but if i close browser in between then the data in all tables is going but when it comes to combination table(view) then itpicks up the value where it was closed and all the data in combination table(views) is not accurate. I dont know what exactly the problem is I am attaching my codes also.
Member
2 Points
5 Posts
Re: Data Overlapping SQL Server Views
Oct 28, 2019 07:59 PM|shubh5506|LINK
This is for 1ST PAGE :
SqlConnection con = new SqlConnection(…)
con.Open();
string save = "INSERT INTO ReporterData(Reporter,Ondutyone,Ondutytwo) VALUES (@Reporter,@Ondutyone,@Ondutytwo)";
SqlCommand cmd = new SqlCommand(save, con);
cmd.Parameters.AddWithValue("@Reporter", DropDownList7.SelectedItem.Value);
cmd.Parameters.AddWithValue("@Ondutyone", DropDownList8.SelectedItem.Value);
cmd.Parameters.AddWithValue("@Ondutytwo", DropDownList9.SelectedItem.Value);
cmd.ExecuteNonQuery();
con.Close();
{
Session["reporter"] = DropDownList7.SelectedItem.Value;
}
Server.Transfer("Student.aspx");
2nd Page :
{
Label18.Text = Session["reporter"].ToString();
}
SqlConnection con = new SqlConnection(...);
con.Open();
string save = "INSERT INTO Studentdata(Student,Phase,Typeofabsence) VALUES (@Student,@Phase,@Typeofabsence)";
SqlCommand cmd = new SqlCommand(save, con);
cmd.Parameters.AddWithValue("@Student", DropDownList4.SelectedItem.Value);
cmd.Parameters.AddWithValue("@Phase", RadioButtonList1.SelectedItem.Value);
cmd.Parameters.AddWithValue("@Typeofabsence", RadioButtonList2.SelectedItem.Value);
cmd.ExecuteNonQuery();
con.Close();
{
Session["name"] = DropDownList4.SelectedItem.Value;
}
Last Page :
{
Label5.Text = Session["reporter"].ToString();
Label6.Text = Session["reporter"].ToString();
}
{
TextBox2.Text = DateTime.Now.ToShortDateString();
TextBox3.Text = DateTime.Now.ToShortTimeString();
}
}
string save = "INSERT INTO Narrative(Narrative,Date,Time) VALUES (@Narrative,@Date,@Time)";
SqlCommand cmd = new SqlCommand(save, con);
cmd.Parameters.AddWithValue("@Narrative", TextBox1.Text);
cmd.Parameters.AddWithValue("@Date", TextBox2.Text);
cmd.Parameters.AddWithValue("@Time", TextBox3.Text);
cmd.ExecuteNonQuery();
{
Session.Remove("name");
Session.Remove("reporter");
}
Now I want to combine all the data in different tables into 1 table so that if the browser closes in between from any reason . The data entering should start from page 1 and go together in 1row.
Contributor
3370 Points
1409 Posts
Re: Data Overlapping SQL Server Views
Oct 29, 2019 08:40 AM|samwu|LINK
Hi shubh5506,
According to your posted code, I can't reproduce your question.
In your code, You just redirect one page to another and pass the value of the session.
Can you show me how did you combine different tables in one table?
So please post the code that can reproduce your question.
Best regards,
Sam