Forms, Class, dataset, database

ahbenshaut

Well-known member
Joined
Oct 29, 2004
Messages
62
Location
Alaska
Programming Experience
5-10
Good Morning. noobie question.
I have created a Windows form, classes and a dataset. The data on the form is split into 2 classes. Here's what Im trying to do:
1. User enters data on the form
2. submit button is clicked
3. Data is added to class properties
4. Data is added to the dataset that I had created previously
5. Data is saved to SQL server.

The problem lies in step 4 and 5. I need to add the data to 2 separate tables, 1 with an autonumber and the other table is using that autonumber as a primary key. I am using a stored procedure that is using the SCOPE_IDENTITY function to return the primary key.

If I am going about this the wrong way please let me know. I could just not even use a dataset but I am trying to understand the benefits of using them.

Please help! :)
 
Usage of DataSet in Database App

Hi,

I would advise you to refer this book Titled: "Database programming using vb.net and SQL server 2000".

(Secrets of developing Accounting Package revealed).

Regards
Bhar
 
DataForm Wizard

A simple form created with Dataform wizard will give you code to study. The wizard creates the buttons and code for all the basic data entry functions. Use it as a tool to help get familiar with code. Specific questions are easier to answer in the forums, and kulrom is great at supplying code.

As for the scope-identity thing, never really got that to work. Since the first table is autonumber, the record added will always be the last in the table. You can add the record, save to the database, reload the dataset, move to the last record and get the primary key just added. Use that key to add a record to the second dataset.


hope that helps.
 
Back
Top