Vous êtes sur la page 1sur 33

Manual Base de Datos de Biblioteca

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 1

Diccionario

ISBN: Nmero estndar internacional de libro

Estante: Lugar donde esta ubicado el libro que se desea buscar

Tipo de usuario: Se Clasifica mediante la ubicacin del alumno, profesor u otro personal

AL: Alumno

PA: Personal Administrativo

PR: Profesor

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 2

SCRIP
create database Biblioteca go use biblioteca go create table Encabezado ( IDEn int identity (1,1) not null, Titulo varchar (30), Autor Varchar (30), Numero_Pagina int, Edicion varchar (30), Editorial varchar (30), Ao_Publicacion int, Numero_Ejemplares int, ISBN varchar (30), constraint pk_ID primary key clustered (IDEn), constraint CKEjemplares check (Numero_Ejemplares>=0) ) Create table Articulos ( IDArticulo int identity (1,1) not null, Nombre_Articulo Varchar (30)not null, Modelo varchar (30), Marca varchar (30), stock int constraint dfstock default (0), constraint pk_IDArt primary key clustered (IDArticulo)

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 3

) create table Usuarios ( IDUsuario int identity (1,1) not null, Nombre Varchar (30)not null, Apellido_Paterno varchar (30), Apellido_Materno varchar (30), E_mail varchar (30), Direccion varchar (30), Colonia varchar (30), Cod_Postal varchar (8), Telefono varchar (20), status varchar (2), constraint pk_IDU primary key clustered (IDUsuario), constraint CKStatus check (Status='AL' or status='PA' or status='PR') ) create table libros ( IDlibro int identity (1,1) not null, IDEn int, Estante varchar (10), Constraint pk_IDLibro primary key clustered (IDlibro), Constraint fk_libEnca Foreign key (IDEn) References Encabezado (IDEn) ) create table PrestamosArticulos ( IDPrestamoArticulo int identity (1,1) not null,

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 4

IDUsuario int, Fecha_Salida datetime, Fecha_Devolucion datetime, Constraint pk_IDPA primary key clustered (IDPrestamoArticulo), Constraint FK_PRUS Foreign Key(IDUsuario) References Usuarios(IDUsuario), constraint ckSalida check (Fecha_Salida = getdate()), constraint ckDevolucion check (Fecha_Devolucion >=getdate()) ) Create table PrestArt ( IDArticulo int, IDPrestamoArticulo int, Fecha_Entrega datetime, Constraint FK_PRSART Foreign Key(IDArticulo) References Articulos(IDArticulo), Constraint FK_PRSPRES Foreign Key(IDPrestamoArticulo) References PrestamosArticulos(IDPrestamoArticulo), constraint CKEntrega check(Fecha_Entrega=getdate()) ) create table Prestamos ( IDPrestamo int identity (1,1) not null, IDUsuario int, Fecha_Salida datetime, Fecha_Devolucion datetime, Constraint pk_IDPres primary key clustered (IDPrestamo), constraint fk_PresUsua Foreign key (IDUsuario) references Usuarios (IDUsuario), constraint ckSalida2 check (Fecha_Salida = getdate()), constraint ckDevolucion2 check (Fecha_Devolucion >=getdate())

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 5

) create table PrestamoLibro ( IDlibro int, IDPrestamo int, Fecha_Entrega datetime, Constraint FK_Plib foreign key (IDlibro) references Libros(IDlibro), Constraint FK_PPre foreign key(IDPrestamo) References Prestamos(IDPrestamo), constraint ckEntrega2 check (Fecha_Entrega = getdate()) )

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 6

Diagrama SQL
Prestamos
IDPrestam o IDUsuario Fecha_Salida Fecha_Devolucion

PrestamoLibro
IDlibro IDPrestam o Fecha_Entrega

Usuarios
IDUsuario Nom bre Apellido_Paterno Apellido_Materno E_m ail Direccion Colonia Cod_Postal Telefono status

libros
IDlibro IDEn Estante

Encabezado
IDEn Titulo Autor Num ero_Pagina Edicion Editorial Ao_Publicacion Num ero_Ejem plares ISBN

PrestArt
IDArticulo IDPrestam oArticulo Fecha_Entrega

PrestamosArticulos
IDPrestam oArticulo IDUsuario Fecha_Salida Fecha_Devolucion

Articulos
IDArticulo Nom bre_Articulo Modelo Marca stock

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 7

Llenado de Base de Datos


DATOS DE LIBROS insert Into Encabezado(Titulo,Autor,Numero_Pagina,Edicion,Editorial,Ao_Publicacion,Numero_Ejemplares,ISBN)values('Don Quijote de la Mancha I','Miguel de Cervantes','517','Primera Edicion','Anaya','1991','250','525561156') insert Into Encabezado(Titulo,Autor,Numero_Pagina,Edicion,Editorial,Ao_Publicacion,Numero_Ejemplares,ISBN)values('Historia de Nueva Orleans','William Faulkuner','186','Segunda Edicion','Alfaguara','1985','150','525561759') insert Into Encabezado(Titulo,Autor,Numero_Pagina,Edicion,Editorial,Ao_Publicacion,Numero_Ejemplares,ISBN)values('El Principe','Maquiavelo','210','Primera Edicion','S.M','1995','210','218454585669') insert Into Encabezado(Titulo,Autor,Numero_Pagina,Edicion,Editorial,Ao_Publicacion,Numero_Ejemplares,ISBN)values('El ultimo Emperador','PuYi','353','Tercera','Caralt','1998','113','71585851584') insert Into Encabezado(Titulo,Autor,Numero_Pagina,Edicion,Editorial,Ao_Publicacion,Numero_Ejemplares,ISBN)values('Fortuna y jacintanta','Perez Galdos','625','Pimera','Plaza & Janes ','1984','284','18791458545458') DATOS DE MATERIA DIDCTICO insert Into Articulos(Nombre_Articulo,Modelo,Marca)values('PROYECTORES','LG DS420','LG') insert Into Articulos(Nombre_Articulo,Modelo,Marca)values('PROYECTORES','Optoma ES522','Optoma') insert Into Articulos(Nombre_Articulo,Modelo,Marca)values('MICROFONO','SENNHEISER EW 100 G2','SENNHEISER') insert Into Articulos(Nombre_Articulo,Modelo,Marca)values('CAMARA DE VIDEO','VARICAN AVC P2 HD','INTRA') insert Into Articulos(Nombre_Articulo,Modelo,Marca)values('CAMARA FOTOGRAFICA','DMC-GF1C','SONY')

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 8

DATOS DEL USUARIO insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('EDUARDO HUMBERTO','ACUA','VALVERDE','liaabdala@hotmail.com','Av. Escaleritas 12','Las Palmas','56618','57249637','PR') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('ELIZABETH','MARTINEZ','GARDUO','rus sa_agout@hotmail.com','Mesa y Lpez 51','Las Palmas','56618','58263795','PR') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('MANUEL','PEREZ','BAILON','Josache@ hotmail.com ','Po Baroja 23','Vizcaya','56620','572496741','PR') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('LUIS ALBERTO','HERNANDEZ','ACOSTA','rataalderete@hotmail.com','El Cid 45','Burgos','56610','75395428','PR') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('CLAUDIA','REYES ','RAMOS','cotoaranda@yahoo.com ','Jaime I, 65','Valencia','56618','57282579','PR') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('DANIELA','DIAZ','VARGAS','DIAZVARGAS DANIELA@HOTMAIL.COM','ORIENTE 2','SAN MIGUEL XICO','56613','26453462','AL') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('ALVARO','RAMIREZ','MORENO','gdl_aml _16@hotmail.com','MANUEL AVILA CAMACHO','GUADALUPANA','56616','56785676','AL') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('DAVID','MARTINEZ','FLORES','CIENTIFIC OLURIAS@HOTMAIL.COM ','PROLONGACION MONTES DE OCA','BARRIO DE LOS REYES','13610','25945528','AL')

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 9

insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('RAFAEL ALFONSO','PASTRANA','FLORES','PASFLO_1991@MSN.COM','NORTE 36','DEL CARMEN','56619','16432362','AL') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('ROBERTO','HERRERA','GARCIA','cotoara nda@yahoo.com ','BAHIA DE TODOS LOS SANTOS','GEOVILLAS DE LA ASUNCION','56618','59860263','AL') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('LEONEL','NARANJO','TUXPEO','DIAZVA RGASDANIELA@HOTMAIL.COM','ORIENTE 2','SAN MIGUEL XICO','56613','26453462','PA') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('MARCO ANTONIO','ZUIGA','VALDEZ','gdl_aml_16@hotmail.com','MANUEL AVILA CAMACHO','GUADALUPANA','56616','56785676','PA') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('ELIMIO','MONDRAGON','NIETO','CIENTI FICOLURIAS@HOTMAIL.COM ','PROLONGACION MONTES DE OCA','BARRIO DE LOS REYES','13610','25945528','PA') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('LETICIA','SABEDRA','HERNANDEZ','PASF LO_1991@MSN.COM','NORTE 36','DEL CARMEN','56619','16432362','PA') insert Into Usuarios(Nombre,Apellido_Paterno,Apellido_Materno,E_mail,Direccion,Colonia,Cod_Postal,Telefono,status)values('BEATRIZ','SANCHEZ','ESPINOZA','cotoar anda@yahoo.com ','BAHIA DE TODOS LOS SANTOS','GEOVILLAS DE LA ASUNCION','56618','59860263','PA')

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 10

Diagrama en Visio

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 11

Cdigo C#
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 proyecto_BD { public partial class ARTICULOS : Form { public ARTICULOS() { InitializeComponent(); }

private void ARTICULOS_Load(object sender, EventArgs e) { sqlDataAdapter1.Fill(dataSet1, "Articulos"); dataGridView1.DataSource = dataSet1; dataGridView1.DataMember = "Articulos"; } private void INSERTAR_Click(object sender, EventArgs e) {

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 12

DataRow Fila = dataSet1.Tables["Articulos"].NewRow(); Fila["Nombre_Articulo"] = ""; Fila["Modelo"] = ""; Fila["Marca"] = ""; Fila["Stock"] = ""; dataSet1.Tables["Articulos"].Rows.Add(Fila); sqlDataAdapter1.Update(dataSet1, "Articulos");

} private void Actualizar_Click(object sender, EventArgs e) { if (dataSet1.HasChanges()) { sqlDataAdapter1.Update(dataSet1, "Articulos"); MessageBox.Show("Actualizacion satisfactoria"); } } private void ELIMINAR_Click(object sender, EventArgs e) { int posicion = dataGridView1.CurrentRow.Index; dataSet1.Tables["Articulos"].Rows[posicion].Delete(); sqlDataAdapter1.Update(dataSet1, "Articulos"); MessageBox.Show("Registro Eliminado"); } } }

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 13

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 proyecto_BD { public partial class ENCABEZADO : Form { public ENCABEZADO() { InitializeComponent(); }

private void ENCABEZADO_Load(object sender, EventArgs e) { sqlDataAdapter1.Fill(dataSet1,"Encabezado"); dataGridView1.DataSource = dataSet1; dataGridView1.DataMember="Encabezado"; } private void Insertar_Click(object sender, EventArgs e) { DataRow Fila = dataSet1.Tables["Encabezado"].NewRow();

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 14

Fila["Titulo"] = ""; Fila["Autor"] = ""; Fila["Edicion"] = ""; Fila["Editorial"] = ""; dataSet1.Tables["Encabezado"].Rows.Add(Fila); sqlDataAdapter1.Update(dataSet1, "Encabezado");

private void Actualizar_Click(object sender, EventArgs e) { if(dataSet1.HasChanges()) { sqlDataAdapter1.Update(dataSet1,"Encabezado"); MessageBox.Show("Actualizacion satisfactoria"); } } private void Eliminar_Click(object sender, EventArgs e) { int posicion = dataGridView1.CurrentRow.Index; dataSet1.Tables["Encabezado"].Rows[posicion].Delete(); sqlDataAdapter1.Update(dataSet1, "Encabezado"); MessageBox.Show("Registro Eliminado"); } } }

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 15

namespace proyecto_BD { partial class ARTICULOS { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null;

/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }

#region Windows Form Designer generated code

/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor.

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 16

/// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ARTICULOS)); this.INSERTAR = new System.Windows.Forms.Button(); this.Actualizar = new System.Windows.Forms.Button(); this.ELIMINAR = new System.Windows.Forms.Button(); this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.dataSet1 = new System.Data.DataSet(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit(); this.SuspendLayout(); // // INSERTAR // this.INSERTAR.Location = new System.Drawing.Point(125, 390); this.INSERTAR.Name = "INSERTAR"; this.INSERTAR.Size = new System.Drawing.Size(75, 23); this.INSERTAR.TabIndex = 0; this.INSERTAR.Text = "INSERTAR"; this.INSERTAR.UseVisualStyleBackColor = true;

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 17

this.INSERTAR.Click += new System.EventHandler(this.INSERTAR_Click); // // Actualizar // this.Actualizar.Location = new System.Drawing.Point(252, 391); this.Actualizar.Name = "Actualizar"; this.Actualizar.Size = new System.Drawing.Size(96, 23); this.Actualizar.TabIndex = 1; this.Actualizar.Text = "ACTUALIZAR"; this.Actualizar.UseVisualStyleBackColor = true; this.Actualizar.Click += new System.EventHandler(this.Actualizar_Click); // // ELIMINAR // this.ELIMINAR.Location = new System.Drawing.Point(405, 391); this.ELIMINAR.Name = "ELIMINAR"; this.ELIMINAR.Size = new System.Drawing.Size(75, 23); this.ELIMINAR.TabIndex = 2; this.ELIMINAR.Text = "ELIMINAR"; this.ELIMINAR.UseVisualStyleBackColor = true; this.ELIMINAR.Click += new System.EventHandler(this.ELIMINAR_Click); // // dataGridView1 // this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Desktop; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Location = new System.Drawing.Point(12, 12);

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 18

this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.Size = new System.Drawing.Size(566, 347); this.dataGridView1.TabIndex = 3; // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT Modelo, Marca, stock\r\nFROM Articu" + "los"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlConnection1 // this.sqlConnection1.ConnectionString = "Data Source=PC0005;Initial Catalog=Biblioteca;Integrated Security=True"; this.sqlConnection1.FireInfoMessageEventOnUserErrors = false; // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = resources.GetString("sqlInsertCommand1.CommandText"); this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Nombre_Articulo", System.Data.SqlDbType.VarChar, 0, "Nombre_Articulo"), new System.Data.SqlClient.SqlParameter("@Modelo", System.Data.SqlDbType.VarChar, 0, "Modelo"), new System.Data.SqlClient.SqlParameter("@Marca", System.Data.SqlDbType.VarChar, 0, "Marca"), IDArticulo, Nombre_Articulo,

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 19

new System.Data.SqlClient.SqlParameter("@stock", System.Data.SqlDbType.Int, 0, "stock")}); // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = resources.GetString("sqlUpdateCommand1.CommandText"); this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Nombre_Articulo", System.Data.SqlDbType.VarChar, 0, "Nombre_Articulo"), new System.Data.SqlClient.SqlParameter("@Modelo", System.Data.SqlDbType.VarChar, 0, "Modelo"), new System.Data.SqlClient.SqlParameter("@Marca", System.Data.SqlDbType.VarChar, 0, "Marca"), new System.Data.SqlClient.SqlParameter("@stock", System.Data.SqlDbType.Int, 0, "stock"), new System.Data.SqlClient.SqlParameter("@Original_IDArticulo", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "IDArticulo", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Nombre_Articulo", System.Data.SqlDbType.VarChar, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Nombre_Articulo", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IsNull_Modelo", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "Modelo", System.Data.DataRowVersion.Original, true, null, "", "", ""), new System.Data.SqlClient.SqlParameter("@Original_Modelo", System.Data.SqlDbType.VarChar, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Modelo", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IsNull_Marca", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "Marca", System.Data.DataRowVersion.Original, true, null, "", "", ""),

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 20

new System.Data.SqlClient.SqlParameter("@Original_Marca", System.Data.SqlDbType.VarChar, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Marca", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IsNull_stock", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "stock", System.Data.DataRowVersion.Original, true, null, "", "", ""), new System.Data.SqlClient.SqlParameter("@Original_stock", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "stock", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IDArticulo", System.Data.SqlDbType.Int, 4, "IDArticulo")}); // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = resources.GetString("sqlDeleteCommand1.CommandText"); this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Original_IDArticulo", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "IDArticulo", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_Nombre_Articulo", System.Data.SqlDbType.VarChar, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Nombre_Articulo", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IsNull_Modelo", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "Modelo", System.Data.DataRowVersion.Original, true, null, "", "", ""), new System.Data.SqlClient.SqlParameter("@Original_Modelo", System.Data.SqlDbType.VarChar, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Modelo", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IsNull_Marca", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "Marca", System.Data.DataRowVersion.Original, true, null, "", "", ""),

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 21

new System.Data.SqlClient.SqlParameter("@Original_Marca", System.Data.SqlDbType.VarChar, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "Marca", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@IsNull_stock", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, ((byte)(0)), ((byte)(0)), "stock", System.Data.DataRowVersion.Original, true, null, "", "", ""), new System.Data.SqlClient.SqlParameter("@Original_stock", System.Data.SqlDbType.Int, 0, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "stock", System.Data.DataRowVersion.Original, null)}); // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Articulos", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("IDArticulo", "IDArticulo"), new System.Data.Common.DataColumnMapping("Nombre_Articulo", "Nombre_Articulo"), new System.Data.Common.DataColumnMapping("Modelo", "Modelo"), new System.Data.Common.DataColumnMapping("Marca", "Marca"), new System.Data.Common.DataColumnMapping("stock", "stock")})}); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; // // dataSet1 // this.dataSet1.DataSetName = "NewDataSet"; //

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 22

// ARTICULOS // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.GradientActiveCaption; this.ClientSize = new System.Drawing.Size(590, 425); this.Controls.Add(this.dataGridView1); this.Controls.Add(this.ELIMINAR); this.Controls.Add(this.Actualizar); this.Controls.Add(this.INSERTAR); this.ForeColor = System.Drawing.SystemColors.ActiveCaption; this.Name = "ARTICULOS"; this.Text = "ARTICULOS"; this.Load += new System.EventHandler(this.ARTICULOS_Load); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).EndInit(); this.ResumeLayout(false);

#endregion

private System.Windows.Forms.Button INSERTAR; private System.Windows.Forms.Button Actualizar; private System.Windows.Forms.Button ELIMINAR; private System.Windows.Forms.DataGridView dataGridView1; private System.Data.SqlClient.SqlCommand sqlSelectCommand1;

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 23

private System.Data.SqlClient.SqlConnection sqlConnection1; private System.Data.SqlClient.SqlCommand sqlInsertCommand1; private System.Data.SqlClient.SqlCommand sqlUpdateCommand1; private System.Data.SqlClient.SqlCommand sqlDeleteCommand1; private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; private System.Data.DataSet dataSet1; } }

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 24

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;

namespace proyecto_BD { public partial class USUARIOS : Form { public USUARIOS() { InitializeComponent(); } private void USUARIOS_Load(object sender, EventArgs e) { sqlDataAdapter1.Fill(dataSet1, "Usuarios"); dataGridView1.DataSource = dataSet1; dataGridView1.DataMember = "Usuarios"; } private void INSERTAR_Click(object sender, EventArgs e) { DataRow Fila = dataSet1.Tables["Usuarios"].NewRow(); Fila["Nombre"] = ""; Fila["Apellido_Paterno"] = "";

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 25

Fila["Apellido_materno"] = ""; Fila["E_mail"] = ""; Fila["Direccion"] = ""; Fila["Colonia"] = ""; Fila["Cod_postal"] = ""; Fila["Telefono"] = ""; Fila["status"] = ""; dataSet1.Tables["Usuarios"].Rows.Add(Fila); sqlDataAdapter1.Update(dataSet1, "Usuarios"); } private void ACTUALIZAR_Click(object sender, EventArgs e) { if (dataSet1.HasChanges()) { sqlDataAdapter1.Update(dataSet1, "Usuarios"); MessageBox.Show("Actualizacion satisfactoria"); } } private void ELIMINAR_Click(object sender, EventArgs e) { int posicion = dataGridView1.CurrentRow.Index; dataSet1.Tables["Usuarios"].Rows[posicion].Delete(); sqlDataAdapter1.Update(dataSet1, "Usuarios"); MessageBox.Show("Registro Eliminado"); } } }

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 26

namespace proyecto_BD { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null;

/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }

#region Windows Form Designer generated code

/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor.

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 27

/// </summary> private void InitializeComponent() { this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.eNCABEZADOToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); this.uSUARIOSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 // this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(264, 24); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = "menuStrip1"; // // toolStripMenuItem1 // this.toolStripMenuItem1.BackColor = System.Drawing.SystemColors.Highlight; this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.eNCABEZADOToolStripMenuItem,

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 28

this.toolStripMenuItem2, this.uSUARIOSToolStripMenuItem}); this.toolStripMenuItem1.ForeColor = System.Drawing.SystemColors.GradientActiveCaption; this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Size = new System.Drawing.Size(128, 20); this.toolStripMenuItem1.Text = "Catalogo BasedeDatos"; // // eNCABEZADOToolStripMenuItem // this.eNCABEZADOToolStripMenuItem.BackColor = System.Drawing.SystemColors.InactiveCaptionText; this.eNCABEZADOToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Highlight; this.eNCABEZADOToolStripMenuItem.Name = "eNCABEZADOToolStripMenuItem"; this.eNCABEZADOToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.eNCABEZADOToolStripMenuItem.Text = "ENCABEZADO"; this.eNCABEZADOToolStripMenuItem.Click += new System.EventHandler(this.eNCABEZADOToolStripMenuItem_Click); // // toolStripMenuItem2 // this.toolStripMenuItem2.BackColor = System.Drawing.SystemColors.InactiveCaptionText; this.toolStripMenuItem2.ForeColor = System.Drawing.SystemColors.Desktop; this.toolStripMenuItem2.Name = "toolStripMenuItem2"; this.toolStripMenuItem2.Size = new System.Drawing.Size(152, 22); this.toolStripMenuItem2.Text = "ARTICULOS"; this.toolStripMenuItem2.Click += new System.EventHandler(this.toolStripMenuItem2_Click);

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 29

// // uSUARIOSToolStripMenuItem // this.uSUARIOSToolStripMenuItem.BackColor = System.Drawing.SystemColors.InactiveCaptionText; this.uSUARIOSToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Highlight; this.uSUARIOSToolStripMenuItem.Name = "uSUARIOSToolStripMenuItem"; this.uSUARIOSToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.uSUARIOSToolStripMenuItem.Text = "USUARIOS"; this.uSUARIOSToolStripMenuItem.Click += new System.EventHandler(this.uSUARIOSToolStripMenuItem_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.Highlight; this.ClientSize = new System.Drawing.Size(264, 318); this.Controls.Add(this.menuStrip1); this.ForeColor = System.Drawing.SystemColors.ActiveCaption; this.MainMenuStrip = this.menuStrip1; this.Name = "Form1"; this.Text = "Form1"; this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout();

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 30

#endregion

private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem eNCABEZADOToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; private System.Windows.Forms.ToolStripMenuItem uSUARIOSToolStripMenuItem; } }

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 31

Alumnos: Daniela Daz Vargas Pastrana Flores Rafael Alfonso Profesor: Horacio Jess Tacubeo Cruz Universidad: Universidad Interamericana para el Desarrollo

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 32

Autores: Daz Vargas Daniela, Pastrana Flores Rafael Alfonso

Pgina 33

Vous aimerez peut-être aussi