Solved

Datasets - using fillschema method

Posted on 2004-09-08
5
293 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
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:Javert93
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks!!!!  This is great!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now