[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Set datatable's columns seperately - vb.net

Hi all,
I would like to know how can I set a datatable's columns in a row sperately. ie, I don't want to set all columns in one time, instead I would like to set columns values seperately - in different sections of my code.
How can I do that in vb.net?

Thanks in advance!
0
nahumba
Asked:
nahumba
  • 3
1 Solution
 
DhaestCommented:
The following code can create a DataColumn with support for adding integer data rows.

        DataColumn dc = new DataColumn("IntegerExample",System.Type.GetType("System.Int32"));
        DataSetVariable.Tables["DataTableName"].Columns.Add(dc);

For more information
Adding DataColumn to a Dataset and DataTable
http://www.codersource.net/dataset_preparing_manual_data_addition.html
0
 
DhaestCommented:
How to: Add Rows to a DataTable  

Dim newCustomersRow As NorthwindDataSet.CustomersRow
newCustomersRow = NorthwindDataSet1.Customers.NewCustomersRow()

--> here you can fill the columns you like to fill...
newCustomersRow.CustomerID = "ALFKI"
newCustomersRow.CompanyName = "Alfreds Futterkiste"

NorthwindDataSet1.Customers.Rows.Add(newCustomersRow)

0
 
DhaestCommented:
Dim customersRow As NorthwindDataSet.CustomersRow
customersRow = NorthwindDataSet1.Customers.FindByCustomerID("ALFKI")
-->  Here you can change the columns you like
customersRow.CompanyName = "Updated Company Name"
customersRow.City = "Seattle"


How to: Edit Rows in a DataTable  
http://msdn2.microsoft.com/en-us/library/tat996zc(VS.80).aspx

0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now