![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
05/02/2010, 20:39
|
| | Fecha de Ingreso: noviembre-2004 Ubicación: Medellín
Mensajes: 121
Antigüedad: 20 años, 3 meses Puntos: 1 | |
Respuesta: Access fin Así es como me conecto
MODULE
Dim cnn As New OleDb.OleDbConnection
Public Function conectar() As OleDb.OleDbConnection
Try
Dim ruta As String
ruta = Application.StartupPath & "\" & "empresa.accdb"
If cnn.State = 1 Then cnn.Close()
cnn.ConnectionString = "provider = microsoft.Ace.Oledb.12.0; data source = '" & ruta & "'"
cnn.Open()
Return cnn
Catch ex As Exception
MessageBox.Show(Err.Description)
Return Nothing
End Try
End Function
Microsoft.Jet.OLEDB.4.0
En el formulario
Dim objConexion As New OleDb.OleDbConnection
Dim objcomando As New OleDb.OleDbCommand
LOAD
objConexion = conectar()
Así busco
Try
objcomando.Connection = objConexion
objcomando.CommandText = "select * from tblcliente where idcliente ='" & Val(texId.Text) & "'"
Dim dt As New DataTable
Dim da As New OleDb.OleDbDataAdapter(objcomando)
da.Fill(dt)
If dt.Rows.Count = 0 Then |