One dataset == Multiple Datasets

Posted on 2011-05-02
Last Modified: 2012-06-27
for a program im developing (thankfully not a syspro) i have a dataset that im taking folders names and the items in the folders and parsing the data inside of them to a spreadsheet. The program goes well, but they want to be able to have different exports for each type of file. (well each type of prefix) I thought about different Datasets for each of their prefixes but that would be over 20 tables... way too many to fit on a single form. Is there any way for me to select a rows based on a certain column? I know i can go through a loop and do a for each line and do it that way but i figure why reinvent the wheel.... if its already invented?
Question by:jnsprad
    LVL 21

    Expert Comment

    well can't you do one dataset with multiple data tables?  That's how you usually pass data to a crystal report app that takes more than one report.
    LVL 1

    Author Comment

    I dont belive ive delt directly with datasets before, im just now touching on them. I usualy let Visual Studio take over the whole ordeal. How would i make different datatables?
    and more yet, how would i add a row to a specific table inside of a dataset
    LVL 4

    Accepted Solution

    This is a link for creating multiple datasets and filling them. They specify datarelations between diff datatables and show how to pull data from either or both tables.

    Another link that shows how to add rows to datatable and edit them

    Added pseudo code below for various data manipulation if needed where you can add column rows and such.
    'declare a new instance for datatable
    dim worktable as datatable=new datatable("person")
    'declare column datatype
    dim column as DataColumn = new DataColumn
    column.DataType = System.Type.GetType("System.Decimal")
    'Add column to dataset
    'iterating through dataset
    for i as integer =0 to custDS.tables(0).rows.count - 1
    'updating a datarow via searching criteria
    Dim customerRow() As Data.DataRow
    customerRow = DataSet1.Tables("Customers").Select("CustomerID = 'ALFKI'")
    customerRow(0)("CompanyName") = "Updated Company Name"
    customerRow(0)("City") = "Seattle"

    Open in new window

    LVL 1

    Author Comment

    Ok, well itl take a littlle work but the code given will work. Thanks so much

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    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 …
    This script will sweep a range of IP addresses (class c only, and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( 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…

    760 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

    7 Experts available now in Live!

    Get 1:1 Help Now