?
Solved

One dataset == Multiple Datasets

Posted on 2011-05-02
4
Medium Priority
?
448 Views
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?
0
Comment
Question by:jnsprad
  • 2
4 Comments
 
LVL 21

Expert Comment

by:silemone
ID: 35506335
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.
0
 
LVL 1

Author Comment

by:jnsprad
ID: 35506496
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
0
 
LVL 4

Accepted Solution

by:
Moizsaif123 earned 500 total points
ID: 35507380
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.
http://msdn.microsoft.com/en-us/library/bh8kx08z(v=vs.71).aspx#Y1234

Another link that shows how to add rows to datatable and edit them
http://msdn.microsoft.com/en-us/library/5ycd1034(VS.80).aspx


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
custDS.tables(0).columns.add(column)

'iterating through dataset
for i as integer =0 to custDS.tables(0).rows.count - 1
   response.write(custDS.tables(0).rows(i).item(1))
next

'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

0
 
LVL 1

Author Comment

by:jnsprad
ID: 35508030
Ok, well itl take a littlle work but the code given will work. Thanks so much
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

809 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