Conexion Bd Visual
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click'Preparamos la cadena de conexión con la base de datos
Dim Conexion As String = "Data Source=02-LAB05-1166\SQLEXPRESS;Database=REIVIN;Integrated Security=True"
' DATA SOURCE= ES ELNOMBRE DEL SERVIDOR DONDE SE ENCUENTRA LA BASE DE DATOS
' DONDE ESTA 02-LAB05-1166\SQLEXPRESS---> ESTA AL ENTRAR AL SQL WINDOWS AUTENTICASION)
' DATABASE= NOMBRE DE LA BASE DE DATOS---REIVIN
'Declaramos el objeto DataSet
Dim MiDataSet As New DataSet()
'Ejecutamos el comando SELECT para la conexión establecida
Dim Comando As NewSqlClient.SqlDataAdapter("SELECT * FROM ALUMNO", Conexion)
'Volcamos los datos al DataSet
Comando.Fill(MiDataSet, "ALUMNOS")
'Liberamos el adaptador de datos,
'pues yatenemos los datos en el DataSet
Comando = Nothing
Dim strTexto As String = ""
' Recorremos las tablas
Dim Row
For Each Row In MiDataSet.Tables(0).RowsstrTexto += Row(1).ToString() & Row(2).ToString() & " -ESCUELA: " & Row(4).ToString() & vbCrLf
Next
'Mostramos la información por pantallaMessageBox.Show(strTexto)
End Sub
End Class
-----------------------------------------------------------------------------
-----OTRO EJEMPLO DIFERENTES TABLAS
Public Class Form1Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Preparamos la cadena de conexión con la base de datos
DimConexion As String = "Data Source=02-LAB05-1166\SQLEXPRESS;Database=REIVIN;Integrated Security=True"
' DATA SOURCE= ES EL NOMBRE DEL SERVIDOR DONDE SE ENCUENTRA LA BASE DE DATOS
'...
Regístrate para leer el documento completo.