Last post Apr 30, 2017 01:23 PM by mgebhard
Apr 30, 2017 01:02 PM|Nilesh31|LINK
I had this Database table with field as - id, name, city, course, sem. I want to insert these data values into the table. In my aspx page I had take Multiview, with two views, where on the first view - I am inserting name and city, on the other view I am
inserting course and sem.
Now I don't understand how to save these data as per my requirement, I am using very simple insert query but it is not giving me the appropriate result, It is giving me null values in my table as well as on the gridview. I don't want these null values. Please
help me with any better query or store procedure to save these data in my table.
Apr 30, 2017 01:23 PM|mgebhard|LINK
INSERT, inserts a new record. You want to INSERT then UPDATE.
Essentially, you'll need to retrieve the record's unique ID on the initial INSERT. Return the ID to the current page in a hidden field. Once the hidden field is set with the ID, the ID will always be available on each successive form submission. Use the
ID to execute an SQL UPDATE where the ID is equal to the ID in the hidden field.
I suggest that you spend a bit of time learning SQL commands like INSERT and UPDATE. Once you have the SQL working then it is a simple matter of passing the required values from the ASPX pages to the SQL.
You also need to learn the
ASP page life cycle and how to persist data in the ASP web forms framework.