How to store history answer data in sql database? - c#

I have a system whereby it can set the open and close dates allowing user to go in and submit answer for survey. The system also wants to delete the most current records from the database.
Example:
Person A:
1st survey: submitted on JAN/2011
2nd survey: submitted on MAR/2012
3rd, 4th...
How can i make sure that data are stored securely and able to retrieve past records and still able to delete latest?
I am thinking of storing latest data on one database and the history data on another database where it could be permanent. But then if records continue to be submitted, will it affect the search if there are more and more data stored? Any suggestion please? Heard about sql08 auditing? does it work?

Why would you want to store them in separate databases, and why would the history be any different than the latest? Just store all their answers for all time.
For the most simple example, if it's a single table for a survey, just store their user id, a unique survey id, and the date that it was submitted. When you want to get the most recent, get the Top 1 sorted by the submit date in descending order.

Related

Inserting data from a asp.net web application to SQL Server

I am currently trying to create a project in ASP.NET to create a stock input web application for a cafe which allows users to input stock data from web. I want to know how to save data from browser to SQL Server.
Screenshot of my current table design / ERD
The Item table will hold all information about each item. Stock_Take_Item table will hold the quantity of each item for a stock take, and Stock_Take table will hold the date of the stock take.
I want to be able to present the user with three columns, One for item description (which will already contain the item descriptions in), the second column for Bar Quantity and able the user to input this value and the third Column for Storage Quantity and also allow the user to input this value.
Once a user has filled out the columns for the stock take, will then press a submit button which will trigger c# code to insert these values into the SQL Database.
I hope this isn't too long winded and someone can give me a good recommendation on how to do so. I fully understand my tables may be wrong, and am open to changing them.
This is not actually a question of the specific problem. you rather need to read a very basic tutorial of ASP.net application.
For your convenience, I suggest you to read This Basic Example which exactly does what you need and just the table name and field names differ. I suggest you read this up first and then come here for very specific questions.

What are table names where "Checkbox Survey" stores Survey titles, responses etc. in SQL Server?

I have to integrate Checkbox Survey in my application and whenever a user submits the survey I need get that record programmatically using CLR triggers.
But the problem is that I am not able to find the name of of tables which are being used by Checkbox survey to store Survey details, responses etc as there are 170 tables in database.
When I went through the list of all tables did not see any table name which looking like containing all above mentioned record. I also queried many tables but did not get that data.
Please help me if you know the solution of my problem?

Is a Database Needed Behind My ASP Site

I am building a website Asp.Net/C# and one component has a schedule with the AJAX Calendar Extender that puts the selected date in a text box, of course. I also have an AJAX Time Picker pick a time in another box.
However, I'm feeling a little ambitious; I want it where if someone selects say... July 25th, 2014, at like 1:30 PM, I want it to throw back a message on selection that the block of time is already selected. The time intervals run every 15 mins apart (i.e., 1:00, 1:15, 1:30, and 1:45).
I'm thinking I need a database behind the site to hold this, maybe SQL Server or would a lightweight Access workup due? My though is that it will hit the database and check for a duplicate instance of the select date and time slot, chosen by the user - then report back if it gets a hit... otherwise, it will populate the date and time text fields in the form.
It's for a small yard service company that makes out calls, but I wanna test and push myself. Any advice and structure suggestions from some seasoned pros who would be greatly appreciated. Thanks. Let me know if I need to provide more details.
If you do not have a database holding the data, where will you store the booked time slot? Where you plan to store your login information like user acc/password.
Of course you can store into text file but I would suggest a light DB like access. It would be enough for you to store few tables with not many line of data.
I do not see any problem with your taught to verify the data again what you stored in db. It should be the way.

Create a page in C# for editing data in SQL Server

I am trying to create a page in C# for editing data in SQL Server, and the data is like title, date, description and that's not a big deal
The problem is each row of this has a foreign key to another table that has image URL so each row has like 3 OR more images.
Like I said before I want to create a page which can edit all of these, I made it with listview but it really really bad so I was trying to find another ideas so can you help me in that
Well, the foreign key isn't that difficult to deal with. When a user edits that FK, before you allow the change to be committed to the cell or saved, run a check against the Db to see if their entry is valid. If it is, allow the edit, if not, cancel their edit of that value.
If that other table is the only table that has a FK to worry about, you could return just the Ids in your initial call and check against the dataset to save some round trips.

Retrieving from database

I have a pre registering system with these tables:
StudentInfo
Courses
Departments
SystemAdmin
RegisteredCoursesCompletely
RegisteredCoursesIncomplete
After creating a login using a stored procedure I need to show the courses that are related to a particular dep id. I did it. After that I needed students to be able to choose every course and then add it to a table and this is where the problems began...
I have two kinds of buttons. One of them is Registered Completely it means user never can go back and changes the courses (I did it) but the second one is Registered Incompletely it means user can go back and see what he/she chose and then uncheck it or check something else.
---> I want to do this in this way if he/she go back I want to show them all courses that related to them with courses that they chose before I mean the checkbox that consisted of data that user checked in the first time. Also show courses that not have been checked yet. All of them in a one grid view.
Please help me. I do everything that my lecture needs but this part that i try to solve it is a little tricky. I used to session and then save the index of the grid view that user checked and then insert it to database but you know more than 20 units user can choose and how do it please explain it with complete code.
in Registered Incompletely scenario you need to save selected courses, user and flag with Registered Incompletely. Then any time same user logged in or go back you can load all the courses and mark the selected courses based on previous saved data. if user is Registered Completely then you can save Registered Completely flag and user details in the database.
Edit:
students and registration complete status need to saved on database, here you can have Boolean value for that. true for complete, false for incomplete. if you have several pages to select courses, then in each page when you move next, save current courses selection in the database. it can be used when you want.

Categories

Resources