First, I am new to VB.NET programming and ADO.NET in particular is giving me trouble. please bear with me, i know just enough to be dangerous.
In the application I am trying to develop, navigation through the data is implemented using a tree structure, and if you want to add a record, edit a record, or delete a record, you can do this from the context menu for each object on the tree. This all works, i have the basic data read and the context menu firing the appropriate commands with the appropriate id's passed to the procedures. SO, now i want to be able to design an input form, that is used for adding new records or updating existing records, one at a time. The deletions i think I can handle.
i would like to design an input form, to be used for adding new or updating one existing record. I want to bind the text fields on the input form to a dataset based on either a returned record for editing, or a new record for adding, but am having conceptual difficulty designing the objects to perform this. I guess i need some help getting started.
I can see two different approaches. Ideally, I want to design a data access class, that will return a bindable object, but this seems a little over my head.
So, I think the easiest way to accomplish what i want is use a dataset/dataadapter interface, binding the text fields to the dataset, and submitting updates using the command methods of the data adapter. When an add happens, i don't know if i want to add the record using a command query, then open it in edit mode.
The simplest table in my database is tblLab. it has 3 fields, LabID (autoincrement, primary key, Random sequence)
LabName is a string, and BldgName is a string.
i want to add a new lab or edit an existing lab (will know the LabID when form opens, if an add or edit, but not sure where i should add the new record, and how to do it vs. when i bind the data to the fields).
I do know how to create a typed dataset, and have played around with manually creating a dataset/dataadapter and modifying, and actually wrote an edit retrieval that worked be returning one row, but i keep thinking i am going the long way around, so i thought it was time to ask an expert.
I don't really expect anyone to fully code this out with steps. what i need is an overview of a logical way to try to do this, and maybe a list of steps, things that i need to make sure happen. maybe code examples for any "tricky" parts. i understand this is quite a bit, so i will make it worth as many points as i can.