Solved

updating database from multiple textboxes

Posted on 2011-03-04
5
608 Views
Last Modified: 2012-05-11
Experts,

Newbie question.

I have a web form and the code-behind is VB.net. The database is SQL Server 2005.

The form is to enter patient data. It was set up with different sections (i.e. Patient Info, Physician info...)

The form contains @30 textboxes. The users need to enter the patient info, click a button and update the database. This works fine.

The users also need to lookup patient records, edit the data and update the database. This also works fine if the patient has one record.

So, the problem is for patients with multiple records.
The users enter a patient ID. I need to bring in all of the records for a patient (this is typically 5-10).

The first record that populates all of the textboxes on the form should be the most recent (DATE_ENTERED filed in the database).

The users want a button to move to the next record(s). They will eventually make a change on one of the records. They want to click a button and have the changes eventually update the database.

Currently, if the patient only had one record, it works by populating atll of the textboxes from a datareader. then when a button is clicked it updates the database with a sql command.

Any assistance handling a situation where the patient has multiple records  is greatly appreciated.

Thank you.
0
Comment
Question by:jvoconnell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 11

Assisted Solution

by:srikanthreddyn143
srikanthreddyn143 earned 100 total points
ID: 35039041
I dont know much about web controls like repeater etc but here is just an idea.

Have a gridview which shows all the patient info (5-10 rows of patient info)

user needs to select one of the row to see the data populated in all your textboxes.

User can edit the data in text boxes and once update button is clicked, patient id can pulled from active row of the grid and other details from text boxes.

0
 
LVL 9

Expert Comment

by:gdupadhyay
ID: 35039343
1. Uset Dataset
2. Assign all patients records into Dataset.
3. Assign the records in text box by reading data from dataset.
4. When user click on update, assign all text box value into dataset and update the database with data adapter.
5. Maintained the last access record ID to display the records in text box after update.

Let me know for any question.
0
 
LVL 1

Author Comment

by:jvoconnell
ID: 35039576
Hello, thanks for the quick responses. Based on the  reply by srikanthreddyn143:, I think I can do something using a gridview. Maybe populate the gridview with patient id and date. THen have uses select desired date and then direct them to the patient entry page. I origianlly wasn't thinking along those lines.  I was originally thinking  about displaying the patient entry page with the most recent record then trying to have some type of navigation button to the other records.


gdupadhyay:, after displaying the first record in the dataset, what would your suggestion be for moving to the next record?

Currently the data is populated on page_load. WHere would you declare the dataset so it would be recognized in the button_click event? WOuld you do something on the page itself or in a sub?

THanks for the assistance. I'm coming from a VBA environment.
0
 
LVL 9

Accepted Solution

by:
gdupadhyay earned 400 total points
ID: 35039662
I answered based on your current design.

But GridView is the best option to display multiple records in one page or one records have multiple fields in one page. Its depened how
you need to design the page according to user requirement.


You can add dataset in a session variable. You can access anywhere in application and reset session variable when you don't need.

Or you can declared a public class with public Property.
Initiate the class object and add the values. You can use List of class object to stored multiple records.

Read the object variable to update the records in DB.
0
 
LVL 1

Author Comment

by:jvoconnell
ID: 35040044
Thank you both for your responses. I think I will be using the session variable but I am going to be able to take something away from both of you so  I want to assign some points to  srikanthreddyn143 as well. Thanks again I appreciate it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question