ya probaste con la ayuda del MSDN?:
Código:
Option Explicit On
Option Strict On
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class Program
Public Shared Sub Main()
Dim connectionString As String = GetConnectionString()
Dim queryString As String = _
"SELECT CategoryID, CategoryName FROM Categories;"
Using connection As New OleDbConnection(connectionString)
Dim command As OleDbCommand = connection.CreateCommand()
command.CommandText = queryString
Try
connection.Open()
Dim dataReader As OleDbDataReader = _
command.ExecuteReader()
Do While dataReader.Read()
Console.WriteLine(vbTab & "{0}" & vbTab & "{1}", _
dataReader(0), dataReader(1))
Loop
dataReader.Close()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Using
End Sub
Private Shared Function GetConnectionString() As String
' To avoid storing the connection string in your code,
' you can retrieve it from a configuration file.
' Assumes Northwind.mdb is located in c:\Data folder.
Return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "c:\Data\Northwind.mdb;User Id=admin;Password=;"
End Function
End Class
este codigo es sencillo para leer desde una DB OLE, ADO.NET es muy complejo, pero tambien puedes ejecutar consultas simples como en otro lenguaje, la ayuda de MSDN es muy extensa y complicada, pero la mas completa
ejecutar consultas:
Código:
Private Sub CreateOleDbCommand( _
ByVal queryString As String, ByVal connectionString As String)
Using connection As New OleDbConnection(connectionString)
connection.Open()
Dim command As New OleDbCommand(queryString, connection)
command.ExecuteNonQuery()
End Using
End Sub