SlideShare a Scribd company logo
1 of 2
INFORME SOBRE COMO CONECTAR VISUAL BASIC 6.0 A LAS SIGUIENTES BASES DE
DATOS.
Pedro Montero
C.I.26653797
Codigo: 50
 Microsoft Access 2003
Option Explicit
Private conexion As ADODB.Connection
Private WithEvents record As ADODB.Recordset
//esto va en el form
Private Sub Form_Load()
Set conexion = New ADODB.Connection
Set record = New ADODB.Recordset
record.LockType = adLockOptimistic
record.CursorType = adOpenKeyset
With conexion //esta condicion es para evitar escribir la variable conexion varis veces
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path &
"archivo.mdb; persist security info=False"
.Open
End With
End Sub
 Microsoft SQL Server 2008
Dim Con As New ADOD.Connection
Dim Rec As New ADODB.Recordaet
Private Sub Command1_click
Con.Open “Driver=SQL Server/Server. /SQLEXPRESS;
Database=FQMS;uid=aa:pwd=saj”
Rec.Open “Select * from database where dbname = ‘ & text1.text & “ ’ ”, con, adOpen5tatic,
adLockReadOnly
If Rec.Recordcount > 0 then
Text2.text Rect.Fields! Location
End If
Rec.close
Con.close
End sub
 MySQL
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sql$
Set cnn = New ADODB.Connection
cnn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
& "SERVER=xx.xxx.xx.xx;" _
& "DATABASE=MIBASE;" _
& "UID=miusuario;PWD=miclave;PORT=3306;OPTION=131072"
cnn.Open
Set rst = New ADODB.Recordset
sql$ = "select Lugar.Provincia from Lugar where Lugar.Region='" & Combo1 & "' Group by
Lugar.provincia"
With rst
.CursorLocation = adUseClient
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open sql$, cnn, , , adCmdText

More Related Content

Similar to Informe sobre como conectar visual basic 6

Vb database connections
Vb database connectionsVb database connections
Vb database connections
Tharsikan
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
Anekwong Yoddumnern
 
IOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and Roles
IOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and RolesIOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and Roles
IOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and Roles
Robert Tilkes
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
Madhuri Kavade
 
Data base connectivity and flex grid in vb
Data base connectivity and flex grid in vbData base connectivity and flex grid in vb
Data base connectivity and flex grid in vb
Amandeep Kaur
 

Similar to Informe sobre como conectar visual basic 6 (20)

Mule esb – connecting to ms sql db
Mule esb – connecting to ms sql dbMule esb – connecting to ms sql db
Mule esb – connecting to ms sql db
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
 
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
 
Knockoutjs
KnockoutjsKnockoutjs
Knockoutjs
 
Dprn3 u3 a1_ocov
Dprn3 u3 a1_ocovDprn3 u3 a1_ocov
Dprn3 u3 a1_ocov
 
ASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NETASP.NET 09 - ADO.NET
ASP.NET 09 - ADO.NET
 
Oracle to vb 6.0 connectivity
Oracle to vb 6.0 connectivityOracle to vb 6.0 connectivity
Oracle to vb 6.0 connectivity
 
ADO.NET -database connection
ADO.NET -database connectionADO.NET -database connection
ADO.NET -database connection
 
Ado.Net
Ado.NetAdo.Net
Ado.Net
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
IOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and Roles
IOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and RolesIOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and Roles
IOD 2012 IDZ-2418A Nationwide's Experince Deploying Trusted Context and Roles
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Jdbc
JdbcJdbc
Jdbc
 
Using advanced options in MariaDB Connector/J
Using advanced options in MariaDB Connector/JUsing advanced options in MariaDB Connector/J
Using advanced options in MariaDB Connector/J
 
Sql server classes in mumbai
Sql server classes in mumbaiSql server classes in mumbai
Sql server classes in mumbai
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
Ch06 ado.net fundamentals
Ch06 ado.net fundamentalsCh06 ado.net fundamentals
Ch06 ado.net fundamentals
 
Data base connectivity and flex grid in vb
Data base connectivity and flex grid in vbData base connectivity and flex grid in vb
Data base connectivity and flex grid in vb
 

More from Pedro Montero (6)

Geologia
GeologiaGeologia
Geologia
 
Geologia 1
Geologia 1Geologia 1
Geologia 1
 
Geologia 1
Geologia 1Geologia 1
Geologia 1
 
Fundamentos de visual basic
Fundamentos de visual basicFundamentos de visual basic
Fundamentos de visual basic
 
4
44
4
 
Ingles
InglesIngles
Ingles
 

Recently uploaded

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 

Recently uploaded (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 

Informe sobre como conectar visual basic 6

  • 1. INFORME SOBRE COMO CONECTAR VISUAL BASIC 6.0 A LAS SIGUIENTES BASES DE DATOS. Pedro Montero C.I.26653797 Codigo: 50  Microsoft Access 2003 Option Explicit Private conexion As ADODB.Connection Private WithEvents record As ADODB.Recordset //esto va en el form Private Sub Form_Load() Set conexion = New ADODB.Connection Set record = New ADODB.Recordset record.LockType = adLockOptimistic record.CursorType = adOpenKeyset With conexion //esta condicion es para evitar escribir la variable conexion varis veces .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "archivo.mdb; persist security info=False" .Open End With End Sub  Microsoft SQL Server 2008 Dim Con As New ADOD.Connection Dim Rec As New ADODB.Recordaet Private Sub Command1_click Con.Open “Driver=SQL Server/Server. /SQLEXPRESS; Database=FQMS;uid=aa:pwd=saj” Rec.Open “Select * from database where dbname = ‘ & text1.text & “ ’ ”, con, adOpen5tatic, adLockReadOnly If Rec.Recordcount > 0 then Text2.text Rect.Fields! Location End If Rec.close Con.close End sub
  • 2.  MySQL Dim cnn As ADODB.Connection Dim rst As ADODB.Recordset Dim sql$ Set cnn = New ADODB.Connection cnn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _ & "SERVER=xx.xxx.xx.xx;" _ & "DATABASE=MIBASE;" _ & "UID=miusuario;PWD=miclave;PORT=3306;OPTION=131072" cnn.Open Set rst = New ADODB.Recordset sql$ = "select Lugar.Provincia from Lugar where Lugar.Region='" & Combo1 & "' Group by Lugar.provincia" With rst .CursorLocation = adUseClient .CursorType = adOpenKeyset .LockType = adLockOptimistic .Open sql$, cnn, , , adCmdText