System.Data namespace contains classes that represent ADO.NET architecture.
ADO.NET efficiently manages data from multiple data sources.
Examples:
Se afișează postările cu eticheta DataSet. Afișați toate postările
Se afișează postările cu eticheta DataSet. Afișați toate postările
luni, 25 august 2014
Populating a DataSet and table from a DataAdapter C#
SQL Adapter to executes the SQL statement or stored procedure referenced in its SelectCommand and put the results into a table in the dataset.
Than you call data adapter's Fill method.
If the dataset contains multiple tables, you should have separate data adapters for each table and must therefore fill each table separately.
Example:
com.CommandTimeout = 30;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = com;
con.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Data");
DataTable dt = ds.Tables[0];
con.Close();
Than you call data adapter's Fill method.
If the dataset contains multiple tables, you should have separate data adapters for each table and must therefore fill each table separately.
SqlConnection con = new SqlConnection("connString");
SqlCommand com = new SqlCommand("exec your_stored_procedure", con);com.CommandTimeout = 30;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = com;
con.Open();
DataSet ds = new DataSet();
da.Fill(ds, "Data");
DataTable dt = ds.Tables[0];
con.Close();
Etichete:
c#,
DataAdapter,
DataSet,
SQL Adapter
DataSet C#
DataSet represents an in-memory cache of data.
DataSet consists of a collection of DataTable objects.
Example:
DataSet consists of a collection of DataTable objects.
Example:
Abonați-vă la:
Postări (Atom)