1. UNIVERSIDADPOLITECNICAAMAZONICA
CURSO: PROGRAMACION III
DOCENTE: MARCO AURELIO PORRO
ALUMNOS:
-CAMPOS GONZALES SHU JUD YUT
-GUEVARA IRIGOIN MARY EVELITH
-PEREZ CADENILLAS IBERIA MERARI
TEMA: OBJETO DE DATATABLE Y DATASET
CARRERA : ING. SISTEMAS Y TELEMATICA
CICLO : V
2. DataTable
DataSet
clase es un miembro de
la System.Data espacio de nombres
dentro de la biblioteca de clases de
.NET Framework. Puede crear y utilizar
un DataTable por separado o como un
miembro de un conjunto de datos
DataTable se representa con
columnas y restricciones.
Un objeto DataSet está formado por una
colección de tablas, relaciones y
restricciones. En
ADO.NET,DataTable objetos se utilizan
para representar las tablas en
un conjunto de datos
es una representación de datos residente
en memoria que proporciona una modelo
de programación
3. EJEMPLO DE DATATABLE
"CompanyName".
private void BindDataGrid()
{
DataTable table = new DataTable();
// Insert code to populate a DataTable with data.
// Bind grid to DataTable.
dataGrid1.DataSource = table;
}
private void ChangeRowFilter()
{
DataTable gridTable = (DataTable) dataGrid1.DataSource;
// Set the RowFilter to display a company names that
// begin with A through I..
gridTable.DefaultView.RowFilter = "CompanyName < 'I'";
}
Ejemplode DataTable
4. using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace sqlconectores
{
public partial class Form1 : Form
{
SqlConnection conn;
DataSet dsEjemplo;
SqlDataAdapter da;
public Form1()
{
InitializeComponent();
}
private void conectar(string cServer, string cDB)
{
if (conn == null)
{
conn= new SqlConnection("Server=" + cServer
+ ";DataBase=" + cDB + ";Integrated Security=SSPI;");
conn.Open();
}
else
{
if (conn.State != ConnectionState.Open)
conn.Open();
}
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs
e)
{
conectar(this.textBox1.Text,
this.textBox2.Text);
}
EJEMPLODE
DATASET