Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Adding data to datatable

Posted on 2008-09-30
2
Medium Priority
?
1,106 Views
Last Modified: 2013-11-26
I am using visual basic .net 2005.
I added a new dataset to my project: DataSet1.xsd
In the DataSet1.xsd, I created a datatable: DataTable1
In the DataTable1 I created columns: DataColumn1, DataColumn2

Im going to be using the the dataset in  crystal report. I have to crystal report created already
using the dataset created above.

Now, I am trying to add rows to the datatable of which is obviously in the dataset
but when I try, I keep getting decleration errors and such.

Anyone  give an example of some code to add rows to a datatable of which
the datasets/datatables are created in the designer.

I have seen code to add rows to datasets/datatables created in code, but i dont want to do it that way.
0
Comment
Question by:crw
[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
2 Comments
 
LVL 27

Accepted Solution

by:
VBRocks earned 2000 total points
ID: 22606006
Dim table as New DataSet1()
table.Rows.Add("Item 1", "Item 2")

'Add 5 rows:
For i as Integer = 1 to 5
    table.Rows.Add("Item " & i, "Item " & (i + 5))
Next
0
 

Author Comment

by:crw
ID: 22608074
Ok, that worked great. Now to use the dataset information between different forms, I would have to create the DIM line above in a module and instead declare the variable  as PUBLIC?
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 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