About 178,000 results
Open links in new tab
  1. DataTable Class (System.Data) | Microsoft Learn

    Writes the current data structure of the DataTable as an XML schema using the specified XmlWriter. To save the schema for the table and all its descendants, set the writeHierarchy parameter to true .

  2. System.Data.DataTable class - .NET | Microsoft Learn

    Jan 9, 2024 · If you're creating a DataTable programmatically, you must first define its schema by adding DataColumn objects to the DataColumnCollection (accessed through the Columns property). For more information about adding DataColumn objects, see Adding Columns to a …

  3. c# - How do I create a DataTable, then add rows to it? - Stack Overflow

    Question 1: How do create a DataTable in C#? Answer 1: DataTable dt = new DataTable(); // DataTable created // Add columns in your DataTable dt.Columns.Add("Name"); dt.Columns.Add("Marks"); Note: There is no need to Clear() the DataTable after creating it. Question 2: How to add row(s)? Answer 2: Add one row: dt.Rows.Add("Ravi","500");

  4. c# - How to create new DataTable with column structure from …

    Sep 25, 2013 · You are looking for the DataTable.Clone() method (available since framework version 1.1). From the documentation: Clone creates a new DataTable with the same structure as the original DataTable, but does not copy any data (the new DataTable will not contain any DataRows). To copy both the structure and data into a new DataTable, use Copy.

  5. c# - Create DataTable with DB table structure - Stack Overflow

    Dec 15, 2008 · What is the best way to create a DataTable with the same structure as a table in my SqlServer database? At present, I am using SqlDataAdapter.Fill() with a query that brings back the columns but no rows.

  6. DataTable Schema Definition - ADO.NET | Microsoft Learn

    Sep 15, 2021 · You define the schema of a DataTable using DataColumn objects as well as ForeignKeyConstraint and UniqueConstraint objects. The columns in a table can map to columns in a data source, contain calculated values from expressions, automatically increment their values, or contain primary key values.

  7. Demystifying the DataTable in C# – A Friendly Deep Dive

    Nov 3, 2023 · DataTables represent tabular data in-memory, similar to a database table, making them a flexible way to work with datasets. In this deep dive, we‘ll unpack everything you need to know about the DataTable – what it is, how to use it, and even some insider tricks.

  8. DataTable Class in C# - Code Maze

    Mar 21, 2023 · DataTable class in C# is an excellent choice for storing and manipulating structured data sets. It has built-in methods to easily define columns and populate rows with data. Properties like PrimaryKey and Constraints enable the …

  9. DataTable In C# - C# Corner

    C# DataTable class represents a data table in C#. Code sample in this article demonstrates how to create a DataTable dynamically in C# code and DataTable rows and DataTable columns and display data in a DataGridView control using DataGridView.DataSource data binding.

  10. Constructing a DataTable Using C# - C# Corner

    In this code example, learn how to create an ADO.NET DataTable in C# at runtime using the DataTable class.

Refresh