SlideShare a Scribd company logo
1 of 4
Insertarbotones en c#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ClaseMiercoles29mayo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void butBuscar_Click(object sender, EventArgs e)
{
string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:basevendedores.accdb";
//Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:UsersCoodinacionDocumentsDatabase2.accdb;Persist Security Info=False";
string ssql = "Select * From Tabla1 where Idv =" + Int32.Parse(textId.Text);
OleDbDataAdapter da = new OleDbDataAdapter(ssql, conexion);
OleDbCommandBuilder cb = new OleDbCommandBuilder(da);
DataTable dt = new DataTable();
da.Fill(dt);
int fila1 = 0;
if (dt.Rows.Count > 0)
{
DataRow dr = dt.Rows[fila1];
textNombre.Text = dr["vNombre"].ToString();
OleDbDataAdapter da2 = new OleDbDataAdapter("select * from Tabla1", conexion);
OleDbCommandBuilder cb2 = new OleDbCommandBuilder(da2);
//DataTable dt2 = new DataTable();
DataSet dsDatos = new DataSet();
da2.Fill(dsDatos, "Vendedores");
this.dataGridView1.DataMember = "Vendedores";
this.dataGridView1.DataSource = dsDatos;
}
else
{
textNombre.Text = "";
MessageBox.Show("No hay datos");
}
}
private void buttInsertar_Click(object sender, EventArgs e)
{
string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:basevendedores.accdb";
string vSql = "Insert into Tabla1 (idv, VNombre) values ( " + Int32.Parse(textId.Text) + " ,'" +
textNombre.Text + "')";
OleDbConnection miConeccion = new OleDbConnection(conexion);
OleDbCommand miComando = new OleDbCommand(vSql);
miComando.Connection = miConeccion;
miConeccion.Open();
miComando.ExecuteNonQuery();
miComando.Connection.Close();
MessageBox.Show("Alumo Agregado exitosamente");
}
private void buttActualizar_Click(object sender, EventArgs e)
{
string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:basevendedores.accdb";
string vSql = "Update Tabla1 set VNOmbre = '" + textNombre.Text + "'" + " where Idv =" +
Int32.Parse(textId.Text);
OleDbConnection miConeccion = new OleDbConnection(conexion);
OleDbCommand miComando = new OleDbCommand(vSql);
miComando.Connection = miConeccion;
miConeccion.Open();
miComando.ExecuteNonQuery();
miComando.Connection.Close();
MessageBox.Show("Alumo Actualizado exitosamente");
}
private void buttEliminar_Click(object sender, EventArgs e)
{
string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:basevendedores.accdb";
string vSql = "Delete from Tabla1 where Idv =" + Int32.Parse(textId.Text);
OleDbConnection miConeccion = new OleDbConnection(conexion);
OleDbCommand miComando = new OleDbCommand(vSql);
miComando.Connection = miConeccion;
miConeccion.Open();
miComando.ExecuteNonQuery();
miComando.Connection.Close();
MessageBox.Show("Alumo Eliminado exitosamente");
}
}
}

More Related Content

What's hot

Wicket Security Presentation
Wicket Security PresentationWicket Security Presentation
Wicket Security Presentationmrmean
 
20131004 - Sq lite sample by Jax
20131004 - Sq lite sample by Jax20131004 - Sq lite sample by Jax
20131004 - Sq lite sample by JaxLearningTech
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass SlidesNir Kaufman
 
Testing with Containers
Testing with ContainersTesting with Containers
Testing with ContainersRomain Baugue
 
Dot net technology
Dot net technologyDot net technology
Dot net technologyMilanMiyani1
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaBabacar NIANG
 
Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4soelinn
 
SPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentSPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentVladimir Medina
 
SPFx working with SharePoint data
SPFx working with SharePoint dataSPFx working with SharePoint data
SPFx working with SharePoint dataVladimir Medina
 
Cocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersCocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersStijn Willems
 
Contact Book Version 1.0
Contact Book Version 1.0Contact Book Version 1.0
Contact Book Version 1.0Salman Mushtaq
 
ObjectCreatorUserGuide
ObjectCreatorUserGuideObjectCreatorUserGuide
ObjectCreatorUserGuideRoger Robins
 

What's hot (20)

Wicket Security Presentation
Wicket Security PresentationWicket Security Presentation
Wicket Security Presentation
 
20131004 - Sq lite sample by Jax
20131004 - Sq lite sample by Jax20131004 - Sq lite sample by Jax
20131004 - Sq lite sample by Jax
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
NestJS
NestJSNestJS
NestJS
 
Testing with Containers
Testing with ContainersTesting with Containers
Testing with Containers
 
Examplecode
ExamplecodeExamplecode
Examplecode
 
SQLite with UWP
SQLite with UWPSQLite with UWP
SQLite with UWP
 
Dot net technology
Dot net technologyDot net technology
Dot net technology
 
Html web sql database
Html web sql databaseHtml web sql database
Html web sql database
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux Saga
 
Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4Retrofit Web Forms with MVC & T4
Retrofit Web Forms with MVC & T4
 
Introduction to ASP.Net Viewstate
Introduction to ASP.Net ViewstateIntroduction to ASP.Net Viewstate
Introduction to ASP.Net Viewstate
 
Sql-Injection
Sql-InjectionSql-Injection
Sql-Injection
 
SPFx: Working with SharePoint Content
SPFx: Working with SharePoint ContentSPFx: Working with SharePoint Content
SPFx: Working with SharePoint Content
 
SPFx working with SharePoint data
SPFx working with SharePoint dataSPFx working with SharePoint data
SPFx working with SharePoint data
 
Cocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollersCocoa heads testing and viewcontrollers
Cocoa heads testing and viewcontrollers
 
Contact Book Version 1.0
Contact Book Version 1.0Contact Book Version 1.0
Contact Book Version 1.0
 
Backendless apps
Backendless appsBackendless apps
Backendless apps
 
iOS testing
iOS testingiOS testing
iOS testing
 
ObjectCreatorUserGuide
ObjectCreatorUserGuideObjectCreatorUserGuide
ObjectCreatorUserGuide
 

Similar to C#

PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMSaraswathiRamalingam
 
in order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdfin order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdfkalerottnerheissst52
 
New text document
New text documentNew text document
New text documentTam Ngo
 
Vb database connections
Vb database connectionsVb database connections
Vb database connectionsTharsikan
 
Program.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdfProgram.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdfanandf0099
 
201003 - Abdullah.pdf
201003 - Abdullah.pdf201003 - Abdullah.pdf
201003 - Abdullah.pdfAbdullah20897
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studioAravindharamanan S
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studioAravindharamanan S
 
3-ADO.NET.pdf
3-ADO.NET.pdf3-ADO.NET.pdf
3-ADO.NET.pdfManalAg
 
Csmr2012 bettenburg presentation
Csmr2012 bettenburg presentationCsmr2012 bettenburg presentation
Csmr2012 bettenburg presentationSAIL_QU
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY GOKUL SREE
 
Asegúr@IT IV - Remote File Downloading
Asegúr@IT IV - Remote File DownloadingAsegúr@IT IV - Remote File Downloading
Asegúr@IT IV - Remote File DownloadingChema Alonso
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursorsinfo_zybotech
 

Similar to C# (20)

PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAMPROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
PROGRAMMING USING C# .NET - SARASWATHI RAMALINGAM
 
in order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdfin order to save data from access database and search from it in c# .pdf
in order to save data from access database and search from it in c# .pdf
 
New text document
New text documentNew text document
New text document
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
 
Soa lab
Soa lab   Soa lab
Soa lab
 
37c
37c37c
37c
 
Program.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdfProgram.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdf
 
menu strip - visual basic
menu strip - visual basicmenu strip - visual basic
menu strip - visual basic
 
201003 - Abdullah.pdf
201003 - Abdullah.pdf201003 - Abdullah.pdf
201003 - Abdullah.pdf
 
spring-tutorial
spring-tutorialspring-tutorial
spring-tutorial
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
Simple ado program by visual studio
Simple ado program by visual studioSimple ado program by visual studio
Simple ado program by visual studio
 
3-ADO.NET.pdf
3-ADO.NET.pdf3-ADO.NET.pdf
3-ADO.NET.pdf
 
Csmr2012 bettenburg presentation
Csmr2012 bettenburg presentationCsmr2012 bettenburg presentation
Csmr2012 bettenburg presentation
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
Database c# connetion
Database c# connetionDatabase c# connetion
Database c# connetion
 
Ditec esoft C# project
Ditec esoft C# projectDitec esoft C# project
Ditec esoft C# project
 
Ditec esoft C# project
Ditec esoft C# project Ditec esoft C# project
Ditec esoft C# project
 
Asegúr@IT IV - Remote File Downloading
Asegúr@IT IV - Remote File DownloadingAsegúr@IT IV - Remote File Downloading
Asegúr@IT IV - Remote File Downloading
 
Accessing data with android cursors
Accessing data with android cursorsAccessing data with android cursors
Accessing data with android cursors
 

More from Armando Gonzalez

Construccion de un ared lan
Construccion de un ared lanConstruccion de un ared lan
Construccion de un ared lanArmando Gonzalez
 
Compartir unudad de cd, impresora , carpeta
Compartir unudad de cd, impresora , carpetaCompartir unudad de cd, impresora , carpeta
Compartir unudad de cd, impresora , carpetaArmando Gonzalez
 
Cresacion de una red lan Packet Tracer
Cresacion de una red lan Packet TracerCresacion de una red lan Packet Tracer
Cresacion de una red lan Packet TracerArmando Gonzalez
 

More from Armando Gonzalez (6)

Insertarbotones en c
Insertarbotones en cInsertarbotones en c
Insertarbotones en c
 
Construccion de un ared lan
Construccion de un ared lanConstruccion de un ared lan
Construccion de un ared lan
 
Reporte network magic
Reporte network magicReporte network magic
Reporte network magic
 
Compartir unudad de cd, impresora , carpeta
Compartir unudad de cd, impresora , carpetaCompartir unudad de cd, impresora , carpeta
Compartir unudad de cd, impresora , carpeta
 
Red servidor
Red servidorRed servidor
Red servidor
 
Cresacion de una red lan Packet Tracer
Cresacion de una red lan Packet TracerCresacion de una red lan Packet Tracer
Cresacion de una red lan Packet Tracer
 

Recently uploaded

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Recently uploaded (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

C#

  • 1. Insertarbotones en c# using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Data.OleDb; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace ClaseMiercoles29mayo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void butBuscar_Click(object sender, EventArgs e) { string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:basevendedores.accdb"; //Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:UsersCoodinacionDocumentsDatabase2.accdb;Persist Security Info=False"; string ssql = "Select * From Tabla1 where Idv =" + Int32.Parse(textId.Text); OleDbDataAdapter da = new OleDbDataAdapter(ssql, conexion);
  • 2. OleDbCommandBuilder cb = new OleDbCommandBuilder(da); DataTable dt = new DataTable(); da.Fill(dt); int fila1 = 0; if (dt.Rows.Count > 0) { DataRow dr = dt.Rows[fila1]; textNombre.Text = dr["vNombre"].ToString(); OleDbDataAdapter da2 = new OleDbDataAdapter("select * from Tabla1", conexion); OleDbCommandBuilder cb2 = new OleDbCommandBuilder(da2); //DataTable dt2 = new DataTable(); DataSet dsDatos = new DataSet(); da2.Fill(dsDatos, "Vendedores"); this.dataGridView1.DataMember = "Vendedores"; this.dataGridView1.DataSource = dsDatos; } else { textNombre.Text = ""; MessageBox.Show("No hay datos"); } }
  • 3. private void buttInsertar_Click(object sender, EventArgs e) { string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:basevendedores.accdb"; string vSql = "Insert into Tabla1 (idv, VNombre) values ( " + Int32.Parse(textId.Text) + " ,'" + textNombre.Text + "')"; OleDbConnection miConeccion = new OleDbConnection(conexion); OleDbCommand miComando = new OleDbCommand(vSql); miComando.Connection = miConeccion; miConeccion.Open(); miComando.ExecuteNonQuery(); miComando.Connection.Close(); MessageBox.Show("Alumo Agregado exitosamente"); } private void buttActualizar_Click(object sender, EventArgs e) { string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:basevendedores.accdb"; string vSql = "Update Tabla1 set VNOmbre = '" + textNombre.Text + "'" + " where Idv =" + Int32.Parse(textId.Text); OleDbConnection miConeccion = new OleDbConnection(conexion); OleDbCommand miComando = new OleDbCommand(vSql); miComando.Connection = miConeccion; miConeccion.Open(); miComando.ExecuteNonQuery(); miComando.Connection.Close(); MessageBox.Show("Alumo Actualizado exitosamente"); }
  • 4. private void buttEliminar_Click(object sender, EventArgs e) { string conexion = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:basevendedores.accdb"; string vSql = "Delete from Tabla1 where Idv =" + Int32.Parse(textId.Text); OleDbConnection miConeccion = new OleDbConnection(conexion); OleDbCommand miComando = new OleDbCommand(vSql); miComando.Connection = miConeccion; miConeccion.Open(); miComando.ExecuteNonQuery(); miComando.Connection.Close(); MessageBox.Show("Alumo Eliminado exitosamente"); } } }