Conexion Bd Visual

Páginas: 3 (737 palabras) Publicado: 21 de mayo de 2012
CONEXIÓN CON SERVIRDOR Y BASE DE DATOS
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
'...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Conexion VB A BD
  • Conexion a bd con php
  • Conexion Php a Bd
  • Conexión De La BD Con Netbeans Y Postgresql
  • Conexion Bd Dacs
  • Conexion acces bd
  • Conexion de visual con acces
  • Conexion Visual SQL

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS