SlideShare a Scribd company logo
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
PRIMERA FORMA EN ADO.NET
VISUAL.NET
Imports System.Data.SqlClient
Public Class Form1
Dim CN As New SqlConnection("data source= . ; database = Northwind ; integrated security = true")
Dim DS As New DataSet
Dim DA As SqlDataAdapter
Dim BUSCAR As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
DA = New SqlDataAdapter("select * from Employees", CN)
DS = New DataSet
DA.Fill(DS, "Employees")
Me.DataGridView1.DataSource = DS.Tables("Employees")
End Sub
Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnnuevo.Click
Me.txtbuscar.Enabled = True
Me.txtbuscar.Text = ""
End Sub
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnbuscar.Click
Dim objdataview As New DataView
Dim buscar As Integer
Me.DataGridView1.DataSource = Nothing
buscar = Me.txtbuscar.Text
objdataview.Table = DS.Tables("Employees")
objdataview.RowFilter = "employeeid= '" & buscar & "'"
If objdataview.Count > 0 Then
Me.DataGridView1.DataSource = objdataview
Me.DataGridView1.Refresh()
Else
MsgBox("registro no encontrado", MsgBoxStyle.Information, "advertencia")
End If
Me.txtbuscar.Enabled = False
End Sub
End Class
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
SEGUNDA FORMA EN ADO.NET
VISUAL BASIC.NET
USE MASTER
CREATE TABLE EMPLEADOS
(CODIGO NVARCHAR(5),
NOMBRE NVARCHAR(25),
APELLIDOS NVARCHAR (25),
DIRECCION NVARCHAR (25),
TELEFONO NVARCHAR (25))
INSERT INTO EMPLEADOS
VALUES ('E0001', 'RICHARD', 'RAMOS BARRIOS' , 'LA VISTORIA', '997798005')
INSERT INTO EMPLEADOS
VALUES ('E0002', 'JUAN ', 'CARLOS ROJAS' , 'MOLINA', '997798008')
INSERT INTO EMPLEADOS
VALUES ('E0003', 'CARLOS', 'LOLO CARLOS' , 'COMAS', '997798007')
INSERT INTO EMPLEADOS
VALUES ('E0004', 'NILDA', 'DURAND MORILLO' , 'LIMA', '997798009')
Imports System.Data.SqlClient
Public Class Form1
Dim CN As New SqlConnection("data source= . ;user id = 123 ; database = master ; integrated security
= true")
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
Dim DS As New DataSet
Dim DA As SqlDataAdapter
Dim dW As New DataView
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
DA = New SqlDataAdapter("SELECT * FROM EMPLEADOS", CN)
DS = New DataSet
DA.Fill(DS, "EMPLEADOS")
Me.DataGridView1.DataSource = DS.Tables("EMPLEADOS")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnnuevo.Click
Dim ctr As Control
For Each ctr In Me.Controls
If TypeOf ctr Is TextBox Then ctr.Text = ""
'Me.DataGridView1.DataSource = Nothing
Next
End Sub
Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnbuscar.Click
Me.DataGridView1.DataSource = Nothing
dW.Table = DS.Tables("empleados")
dW.RowFilter = "codigo = '" & txtcodigo.Text & "'"
If dW.Count > 0 Then
Me.DataGridView1.DataSource = dW
Me.DataGridView1.Refresh()
Me.txtcodigo.Text = Me.DataGridView1.Item(0, 0).Value
Me.txtnombre.Text = Me.DataGridView1.Item(1, 0).Value
Me.txtapellidos.Text = Me.DataGridView1.Item(2, 0).Value
Me.txtdireccion.Text = Me.DataGridView1.Item(3, 0).Value
Me.txttelefono.Text = Me.DataGridView1.Item(4, 0).Value
Else
MsgBox("REGISTRO NO ENCONTRADO")
End If
End Sub
End Class
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
TERCERA FORMA ADO.NET
VISUAL BASIC.NET
USE MASTER
CREATE TABLE EMPLEADOS
(CODIGO NVARCHAR(5),
NOMBRE NVARCHAR(25),
APELLIDOS NVARCHAR (25),
DIRECCION NVARCHAR (25),
TELEFONO NVARCHAR (25))
INSERT INTO EMPLEADOS VALUES ('E0001', 'RICHARD' , 'RAMOS BARRIOS' , 'LA VISTORIA',
'997798005')
INSERT INTO EMPLEADOS VALUES ('E0002', 'JUAN ' , 'CARLOS ROJAS' , 'MOLINA', '997798008')
INSERT INTO EMPLEADOS VALUES ('E0003', 'CARLOS ' , 'LOLO CARLOS' , 'COMAS', '997798007')
INSERT INTO EMPLEADOS VALUES ('E0004', 'NILDA' , 'DURAND MORILLO' , 'LIMA', '997798009')
select * from empleados
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com
Imports System.Data.SqlClient
Public Class form1
Dim CN As New SqlConnection("data source= . ; database = MASTER; integrated security = true")
Dim cmd As SqlCommand
Dim dr As SqlDataReader
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnsalir.Click
End
End Sub
Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnnuevo.Click
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Text = ""
Next
Me.btnnuevo.Text = "buscar"
End Sub
Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnbuscar.Click
Try
If btnbuscar.Text = "buscar" Then
Me.btnbuscar.Text = "buscar ahora"
Me.txtcodigo.Enabled = True
Me.txtcodigo.Focus()
Else
cmd = New SqlCommand("select * from empleados where codigo = '" & Me.txtcodigo.Text & "'", CN)
CN.Open()
dr = cmd.ExecuteReader
If dr.Read Then
Me.txtnombre.Text = dr("nombre")
Me.txtapellidos.Text = dr("apellidos")
Me.txtdireccion.Text = dr("direccion")
Me.txttelefono.Text = dr("telefono")
Else
MessageBox.Show("el codigo no existe", "error", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
CN.Close()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
http://sistemasddm.blogspot.com
tkd.ddm@gmail.com

More Related Content

What's hot

Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
yogita kachve
 
Fundamentos de BD - Unidad 6 lenguaje sql
Fundamentos de BD - Unidad 6 lenguaje sqlFundamentos de BD - Unidad 6 lenguaje sql
Fundamentos de BD - Unidad 6 lenguaje sql
José Antonio Sandoval Acosta
 
HTML and CSS.pptx
HTML and CSS.pptxHTML and CSS.pptx
HTML and CSS.pptx
TripleRainbow
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
Vibrant Technologies & Computers
 
Crystal report
Crystal reportCrystal report
Crystal report
Everywhere
 
Assemblies
AssembliesAssemblies
Assemblies
Janas Khan
 
Introduccion bases de datos
Introduccion bases de datosIntroduccion bases de datos
Introduccion bases de datos
UTN
 
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3
Fabio Filardi
 
My Sql Work Bench
My Sql Work BenchMy Sql Work Bench
My Sql Work Bench
Lahiru Danushka
 
ADO.NET
ADO.NETADO.NET
ADO.NET
Wani Zahoor
 
Apuntes de DTD
Apuntes de DTDApuntes de DTD
Apuntes de DTD
Abrirllave
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
Naimul Arif
 
MySQL: Indexing for Better Performance
MySQL: Indexing for Better PerformanceMySQL: Indexing for Better Performance
MySQL: Indexing for Better Performance
jkeriaki
 
Cập nhật csdl ngay trên datagridview trong vb
Cập nhật csdl ngay trên datagridview trong vbCập nhật csdl ngay trên datagridview trong vb
Cập nhật csdl ngay trên datagridview trong vbANHMATTROI
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#Doncho Minkov
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle Sql
Ahmed Yaseen
 
Crud tutorial en
Crud tutorial enCrud tutorial en
Crud tutorial enforkgrown
 
Window functions in MySQL 8.0
Window functions in MySQL 8.0Window functions in MySQL 8.0
Window functions in MySQL 8.0
Mydbops
 

What's hot (20)

Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
Namespaces in C#
Namespaces in C#Namespaces in C#
Namespaces in C#
 
Fundamentos de BD - Unidad 6 lenguaje sql
Fundamentos de BD - Unidad 6 lenguaje sqlFundamentos de BD - Unidad 6 lenguaje sql
Fundamentos de BD - Unidad 6 lenguaje sql
 
HTML and CSS.pptx
HTML and CSS.pptxHTML and CSS.pptx
HTML and CSS.pptx
 
Sql server T-sql basics ppt-3
Sql server T-sql basics  ppt-3Sql server T-sql basics  ppt-3
Sql server T-sql basics ppt-3
 
Crystal report
Crystal reportCrystal report
Crystal report
 
Assemblies
AssembliesAssemblies
Assemblies
 
Introduccion bases de datos
Introduccion bases de datosIntroduccion bases de datos
Introduccion bases de datos
 
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 2/3
 
My Sql Work Bench
My Sql Work BenchMy Sql Work Bench
My Sql Work Bench
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Apuntes de DTD
Apuntes de DTDApuntes de DTD
Apuntes de DTD
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
Active x control
Active x controlActive x control
Active x control
 
MySQL: Indexing for Better Performance
MySQL: Indexing for Better PerformanceMySQL: Indexing for Better Performance
MySQL: Indexing for Better Performance
 
Cập nhật csdl ngay trên datagridview trong vb
Cập nhật csdl ngay trên datagridview trong vbCập nhật csdl ngay trên datagridview trong vb
Cập nhật csdl ngay trên datagridview trong vb
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Introduction To Oracle Sql
Introduction To Oracle SqlIntroduction To Oracle Sql
Introduction To Oracle Sql
 
Crud tutorial en
Crud tutorial enCrud tutorial en
Crud tutorial en
 
Window functions in MySQL 8.0
Window functions in MySQL 8.0Window functions in MySQL 8.0
Window functions in MySQL 8.0
 

Viewers also liked

Ejemplos Borland C++ Builder
Ejemplos Borland C++ BuilderEjemplos Borland C++ Builder
Ejemplos Borland C++ Builder
Darwin Durand
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
Darwin Durand
 
Clase nro2 vb net 2010 rivera & g
Clase nro2 vb net 2010 rivera & gClase nro2 vb net 2010 rivera & g
Clase nro2 vb net 2010 rivera & g
Santos Rivera Luján
 
Digital library presentation
Digital library presentationDigital library presentation
Digital library presentation
medo9477
 
APLICACIONES EMPRESARIALES
APLICACIONES EMPRESARIALESAPLICACIONES EMPRESARIALES
APLICACIONES EMPRESARIALESDarwin Durand
 
PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)
PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)
PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)Darwin Durand
 
CREACION DE DLL Y USO (Ejemplo desarrollado)
CREACION DE DLL Y USO (Ejemplo desarrollado)CREACION DE DLL Y USO (Ejemplo desarrollado)
CREACION DE DLL Y USO (Ejemplo desarrollado)Darwin Durand
 
Visual basic-Programacion en un entorno grafico.
Visual basic-Programacion en un entorno grafico.Visual basic-Programacion en un entorno grafico.
Visual basic-Programacion en un entorno grafico.
Kenia Flores Cruz
 
Lenguajes programacion
Lenguajes programacionLenguajes programacion
Lenguajes programacionXavii Torres
 
PERSISTENCIA BASADA EN ARCHIVOS
PERSISTENCIA BASADA EN ARCHIVOSPERSISTENCIA BASADA EN ARCHIVOS
PERSISTENCIA BASADA EN ARCHIVOSDarwin Durand
 
Estudio comparativo de PHP, ASP.NET Y JAVA
Estudio comparativo de PHP, ASP.NET Y JAVAEstudio comparativo de PHP, ASP.NET Y JAVA
Estudio comparativo de PHP, ASP.NET Y JAVAHelmilpa
 
Practica de visual basic sistema de facturación
Practica de visual basic sistema de facturaciónPractica de visual basic sistema de facturación
Practica de visual basic sistema de facturación
milenka796
 
Caja de herramientas de visual basic
Caja de herramientas de visual basicCaja de herramientas de visual basic
Caja de herramientas de visual basicNoe Cayetano
 
Cuadro de herramientas y botones en visual basic
Cuadro de herramientas y botones en visual basicCuadro de herramientas y botones en visual basic
Cuadro de herramientas y botones en visual basic
German Enrique Granados Tellez
 
CONEXION VISUAL STUDIO.NET - SQL SERVER
CONEXION VISUAL STUDIO.NET - SQL SERVERCONEXION VISUAL STUDIO.NET - SQL SERVER
CONEXION VISUAL STUDIO.NET - SQL SERVERDarwin Durand
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
Darwin Durand
 
Visual Basic .NET
Visual Basic .NETVisual Basic .NET
Visual Basic .NETDavid
 
Parte del entorno de visual basic
Parte del entorno de visual basicParte del entorno de visual basic
Parte del entorno de visual basicdabinson02
 

Viewers also liked (20)

Ejemplos Borland C++ Builder
Ejemplos Borland C++ BuilderEjemplos Borland C++ Builder
Ejemplos Borland C++ Builder
 
SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)SISTEMA DE FACTURACION (Ejemplo desarrollado)
SISTEMA DE FACTURACION (Ejemplo desarrollado)
 
Clase nro2 vb net 2010 rivera & g
Clase nro2 vb net 2010 rivera & gClase nro2 vb net 2010 rivera & g
Clase nro2 vb net 2010 rivera & g
 
Digital library presentation
Digital library presentationDigital library presentation
Digital library presentation
 
APLICACIONES EMPRESARIALES
APLICACIONES EMPRESARIALESAPLICACIONES EMPRESARIALES
APLICACIONES EMPRESARIALES
 
PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)
PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)
PROYECTO PRUEBA DE CONEXIONES (Mantenimiento)
 
CREACION DE DLL Y USO (Ejemplo desarrollado)
CREACION DE DLL Y USO (Ejemplo desarrollado)CREACION DE DLL Y USO (Ejemplo desarrollado)
CREACION DE DLL Y USO (Ejemplo desarrollado)
 
Visual basic-Programacion en un entorno grafico.
Visual basic-Programacion en un entorno grafico.Visual basic-Programacion en un entorno grafico.
Visual basic-Programacion en un entorno grafico.
 
Lenguajes programacion
Lenguajes programacionLenguajes programacion
Lenguajes programacion
 
SERVLET BASICS
SERVLET BASICSSERVLET BASICS
SERVLET BASICS
 
PERSISTENCIA BASADA EN ARCHIVOS
PERSISTENCIA BASADA EN ARCHIVOSPERSISTENCIA BASADA EN ARCHIVOS
PERSISTENCIA BASADA EN ARCHIVOS
 
CREACION DE TABLAS
CREACION DE TABLASCREACION DE TABLAS
CREACION DE TABLAS
 
Estudio comparativo de PHP, ASP.NET Y JAVA
Estudio comparativo de PHP, ASP.NET Y JAVAEstudio comparativo de PHP, ASP.NET Y JAVA
Estudio comparativo de PHP, ASP.NET Y JAVA
 
Practica de visual basic sistema de facturación
Practica de visual basic sistema de facturaciónPractica de visual basic sistema de facturación
Practica de visual basic sistema de facturación
 
Caja de herramientas de visual basic
Caja de herramientas de visual basicCaja de herramientas de visual basic
Caja de herramientas de visual basic
 
Cuadro de herramientas y botones en visual basic
Cuadro de herramientas y botones en visual basicCuadro de herramientas y botones en visual basic
Cuadro de herramientas y botones en visual basic
 
CONEXION VISUAL STUDIO.NET - SQL SERVER
CONEXION VISUAL STUDIO.NET - SQL SERVERCONEXION VISUAL STUDIO.NET - SQL SERVER
CONEXION VISUAL STUDIO.NET - SQL SERVER
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
Visual Basic .NET
Visual Basic .NETVisual Basic .NET
Visual Basic .NET
 
Parte del entorno de visual basic
Parte del entorno de visual basicParte del entorno de visual basic
Parte del entorno de visual basic
 

Similar to Visual Studio.Net - Sql Server

Vb Project ขั้นเทพ
Vb Project ขั้นเทพVb Project ขั้นเทพ
Vb Project ขั้นเทพ
Sinchai Lanon
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01mafv1976
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventasDAYANA RETO
 
Form1.vb
Form1.vbForm1.vb
Form1.vb
Like Music
 
Aplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnetAplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnet
Diaz Alfahrezy
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
Azki Nabidin
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .net
Ayuda Universidad
 
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
apnashop1
 
OOP - PREFINAL ACTIVITY - ACLC
OOP - PREFINAL ACTIVITY - ACLCOOP - PREFINAL ACTIVITY - ACLC
OOP - PREFINAL ACTIVITY - ACLCMarlo Tinio
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
Dr.M.Karthika parthasarathy
 
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
 
Student information system
Student information systemStudent information system
Student information system
patrick7772
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
Tharsikan
 
Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
Codes
CodesCodes
Codes
OSit3
 
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdfImports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
fantabulustredingco
 

Similar to Visual Studio.Net - Sql Server (20)

Vb Project ขั้นเทพ
Vb Project ขั้นเทพVb Project ขั้นเทพ
Vb Project ขั้นเทพ
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01
 
Sistema de ventas
Sistema de ventasSistema de ventas
Sistema de ventas
 
Form1.vb
Form1.vbForm1.vb
Form1.vb
 
Aplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnetAplikasi rawat-inap-vbnet
Aplikasi rawat-inap-vbnet
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
 
Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .net
 
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
 
Public class form1
Public class form1Public class form1
Public class form1
 
Public class form1
Public class form1Public class form1
Public class form1
 
OOP - PREFINAL ACTIVITY - ACLC
OOP - PREFINAL ACTIVITY - ACLCOOP - PREFINAL ACTIVITY - ACLC
OOP - PREFINAL ACTIVITY - ACLC
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY DOT NET LAB PROGRAM PERIYAR UNIVERSITY
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
 
Student information system
Student information systemStudent information system
Student information system
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
 
Inventory management
Inventory managementInventory management
Inventory management
 
Rental
RentalRental
Rental
 
Codes
CodesCodes
Codes
 
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdfImports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
 

More from Darwin Durand

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEDarwin Durand
 
EJEMPLOS DESARROLLADOS
EJEMPLOS DESARROLLADOSEJEMPLOS DESARROLLADOS
EJEMPLOS DESARROLLADOSDarwin Durand
 
CURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOL
CURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOLCURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOL
CURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOLDarwin Durand
 
INDICES EN SQL SERVER
INDICES EN SQL SERVERINDICES EN SQL SERVER
INDICES EN SQL SERVERDarwin Durand
 
CREACION Y MANEJO DE LA BASE DE DATOS
CREACION Y MANEJO DE LA BASE DE DATOSCREACION Y MANEJO DE LA BASE DE DATOS
CREACION Y MANEJO DE LA BASE DE DATOSDarwin Durand
 

More from Darwin Durand (6)

VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLEVISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
 
EJEMPLOS DESARROLLADOS
EJEMPLOS DESARROLLADOSEJEMPLOS DESARROLLADOS
EJEMPLOS DESARROLLADOS
 
CURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOL
CURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOLCURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOL
CURSO DE PROGRAMACION AVANZADA EN JAVA EN ESPAÑOL
 
INDICES EN SQL SERVER
INDICES EN SQL SERVERINDICES EN SQL SERVER
INDICES EN SQL SERVER
 
INTEGRIDAD DE DATOS
INTEGRIDAD DE DATOSINTEGRIDAD DE DATOS
INTEGRIDAD DE DATOS
 
CREACION Y MANEJO DE LA BASE DE DATOS
CREACION Y MANEJO DE LA BASE DE DATOSCREACION Y MANEJO DE LA BASE DE DATOS
CREACION Y MANEJO DE LA BASE DE DATOS
 

Recently uploaded

Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

Visual Studio.Net - Sql Server

  • 1. http://sistemasddm.blogspot.com tkd.ddm@gmail.com PRIMERA FORMA EN ADO.NET VISUAL.NET Imports System.Data.SqlClient Public Class Form1 Dim CN As New SqlConnection("data source= . ; database = Northwind ; integrated security = true") Dim DS As New DataSet Dim DA As SqlDataAdapter Dim BUSCAR As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DA = New SqlDataAdapter("select * from Employees", CN) DS = New DataSet DA.Fill(DS, "Employees") Me.DataGridView1.DataSource = DS.Tables("Employees") End Sub Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click Me.txtbuscar.Enabled = True Me.txtbuscar.Text = "" End Sub
  • 2. http://sistemasddm.blogspot.com tkd.ddm@gmail.com Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbuscar.Click Dim objdataview As New DataView Dim buscar As Integer Me.DataGridView1.DataSource = Nothing buscar = Me.txtbuscar.Text objdataview.Table = DS.Tables("Employees") objdataview.RowFilter = "employeeid= '" & buscar & "'" If objdataview.Count > 0 Then Me.DataGridView1.DataSource = objdataview Me.DataGridView1.Refresh() Else MsgBox("registro no encontrado", MsgBoxStyle.Information, "advertencia") End If Me.txtbuscar.Enabled = False End Sub End Class
  • 3. http://sistemasddm.blogspot.com tkd.ddm@gmail.com SEGUNDA FORMA EN ADO.NET VISUAL BASIC.NET USE MASTER CREATE TABLE EMPLEADOS (CODIGO NVARCHAR(5), NOMBRE NVARCHAR(25), APELLIDOS NVARCHAR (25), DIRECCION NVARCHAR (25), TELEFONO NVARCHAR (25)) INSERT INTO EMPLEADOS VALUES ('E0001', 'RICHARD', 'RAMOS BARRIOS' , 'LA VISTORIA', '997798005') INSERT INTO EMPLEADOS VALUES ('E0002', 'JUAN ', 'CARLOS ROJAS' , 'MOLINA', '997798008') INSERT INTO EMPLEADOS VALUES ('E0003', 'CARLOS', 'LOLO CARLOS' , 'COMAS', '997798007') INSERT INTO EMPLEADOS VALUES ('E0004', 'NILDA', 'DURAND MORILLO' , 'LIMA', '997798009') Imports System.Data.SqlClient Public Class Form1 Dim CN As New SqlConnection("data source= . ;user id = 123 ; database = master ; integrated security = true")
  • 4. http://sistemasddm.blogspot.com tkd.ddm@gmail.com Dim DS As New DataSet Dim DA As SqlDataAdapter Dim dW As New DataView Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DA = New SqlDataAdapter("SELECT * FROM EMPLEADOS", CN) DS = New DataSet DA.Fill(DS, "EMPLEADOS") Me.DataGridView1.DataSource = DS.Tables("EMPLEADOS") End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click Dim ctr As Control For Each ctr In Me.Controls If TypeOf ctr Is TextBox Then ctr.Text = "" 'Me.DataGridView1.DataSource = Nothing Next End Sub Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbuscar.Click Me.DataGridView1.DataSource = Nothing dW.Table = DS.Tables("empleados") dW.RowFilter = "codigo = '" & txtcodigo.Text & "'" If dW.Count > 0 Then Me.DataGridView1.DataSource = dW Me.DataGridView1.Refresh() Me.txtcodigo.Text = Me.DataGridView1.Item(0, 0).Value Me.txtnombre.Text = Me.DataGridView1.Item(1, 0).Value Me.txtapellidos.Text = Me.DataGridView1.Item(2, 0).Value Me.txtdireccion.Text = Me.DataGridView1.Item(3, 0).Value Me.txttelefono.Text = Me.DataGridView1.Item(4, 0).Value Else MsgBox("REGISTRO NO ENCONTRADO") End If End Sub End Class
  • 5. http://sistemasddm.blogspot.com tkd.ddm@gmail.com TERCERA FORMA ADO.NET VISUAL BASIC.NET USE MASTER CREATE TABLE EMPLEADOS (CODIGO NVARCHAR(5), NOMBRE NVARCHAR(25), APELLIDOS NVARCHAR (25), DIRECCION NVARCHAR (25), TELEFONO NVARCHAR (25)) INSERT INTO EMPLEADOS VALUES ('E0001', 'RICHARD' , 'RAMOS BARRIOS' , 'LA VISTORIA', '997798005') INSERT INTO EMPLEADOS VALUES ('E0002', 'JUAN ' , 'CARLOS ROJAS' , 'MOLINA', '997798008') INSERT INTO EMPLEADOS VALUES ('E0003', 'CARLOS ' , 'LOLO CARLOS' , 'COMAS', '997798007') INSERT INTO EMPLEADOS VALUES ('E0004', 'NILDA' , 'DURAND MORILLO' , 'LIMA', '997798009') select * from empleados
  • 7. http://sistemasddm.blogspot.com tkd.ddm@gmail.com Imports System.Data.SqlClient Public Class form1 Dim CN As New SqlConnection("data source= . ; database = MASTER; integrated security = true") Dim cmd As SqlCommand Dim dr As SqlDataReader Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsalir.Click End End Sub Private Sub btnnuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnuevo.Click Dim ctrl As Control For Each ctrl In Me.Controls If TypeOf ctrl Is TextBox Then ctrl.Text = "" Next Me.btnnuevo.Text = "buscar" End Sub Private Sub btnbuscar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbuscar.Click Try If btnbuscar.Text = "buscar" Then Me.btnbuscar.Text = "buscar ahora" Me.txtcodigo.Enabled = True Me.txtcodigo.Focus() Else cmd = New SqlCommand("select * from empleados where codigo = '" & Me.txtcodigo.Text & "'", CN) CN.Open() dr = cmd.ExecuteReader If dr.Read Then Me.txtnombre.Text = dr("nombre") Me.txtapellidos.Text = dr("apellidos") Me.txtdireccion.Text = dr("direccion") Me.txttelefono.Text = dr("telefono") Else MessageBox.Show("el codigo no existe", "error", MessageBoxButtons.OK, MessageBoxIcon.Information) End If CN.Close() End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class