Solved

Datasets - using fillschema method

Posted on 2004-09-08
5
302 Views
Last Modified: 2008-02-26
Newbie here!  I am creating a Budgeting app for my boss to use in our IT Department.  Currently, it is a simple Access database with a few tables, forms, and reports.  I have imported the data into sql and am working on making a web interface for entering all of our purchases/budget information.  I am trying to figure out the best way to get 5 sql tables into a dataset, along with specifying relationships.

Can I use the fillschema method on a data adaper for more than one table?  In other words, can I do something like this:

da.FillSchema(ds, SchemaType.Source, "Vendors")
da.FillSchema(ds, SchemaType.Source, "Invoices")

Also, I have a number of features I want to be able to do in my web app.  For instance, I want the user to be able to "add a vendor" and "add an invoice".  Should I create separate webpages for vendors and invoices or should I have one main page that gets changed dynamically depending on which feature the user clicks on?  

I hope I have explained myself clearly!  Thanks!
0
Comment
Question by:tsbathe
[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
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Javert93
ID: 12029898
For the first question, you can't use FillSchema() to do what you want. Here is the easiest way (I think):

    1) Create a new component and drop an OleDataAdapter onto it (one for each table).
    2) Right-click on the component designer and choose "Generate DataSet..." from the context menu (or select it from the hyperlink in the properties window).
    3) In the "Generate DataSet" dialog, enter a class name for the dataset and check all the tables you want to include (the list will come from the data adapters).
    4) Once you click OK, the IDE will add a typed dataset class to your project, which you can use to store your data.
    5) Add a "Fill" method to you component class that accepts the typed dataset as a parameter and pass it into each of the data adapters you dropped on the component in the first step. Note that because the dataset contains multiple tables and relationships, it will enforce those relationships (event during a fill). So, you need to fill parent tables before you fill child tables, otherwise Fill() will throw an exception.
    6) Optionally, you should add an Update() method to you component that calls Update() on each of the data adapters if you are a planning to modify the data in the database.
    7) You can instantiate and use the component in your .NET code the same way you would use a class.

To answer the second question, I would recommend using different pages (it will make you life a lot easier).
0
 

Author Comment

by:tsbathe
ID: 12030116
A wonderfully complete answer!!!  You answered other questions I had too.  Filling the parent tables first, duh I should have realized!! Thanks!
0
 

Author Comment

by:tsbathe
ID: 12030328
One more question.  I just made the component (I've never made one before).  Is there a way I can reference the dataset in the component in design mode?  ie for specifying the datasource of a datagrid?
0
 
LVL 4

Accepted Solution

by:
Javert93 earned 50 total points
ID: 12030385
You can drop the dataset onto the Web Form Designer from the Solutions Explorer tree view. Then you should be able to reference it from the ASP.NET server controls using the properties window.
0
 

Author Comment

by:tsbathe
ID: 12030434
Thanks!!!!  This is great!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

622 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