You are on page 1of 2

Imports System. Data.SqlClient Imports.System.Data.

Odbc Module Module1 Public conSql As SqlConnection Public conMySql As OdbcConnection Public Sub ConectarSql () conSql = New SqlConnection conSql.ConnectionString = (server=(local); database=TESCI; Integrated security) conSql.Open() End Sub Public Sub conectarMysql() conMysql = New OdbcConnection conMySql.ConnectionString = (DSN=TESCI) conectarMysql----End Module

Button 2 Dim Sql As String Dim commSql As SqlCommand Dim res As Integer Private Sub button1_Click(sender As Objet, e As EventArgs) Handles Button.Click tNc.Clear() tNom.Clear() tAp.Clear() tAm.Clear() End Sub Private Sub Button2_Click(Sender As Object, e As EventArgs) Handles Button2 .Click SQL = insert into alumnos values (+ tNc.Text + ,+ tNom.Text + , tAp.Text tAm.Text +) conectarSql() commSql = New SqlCommand (SQL, conSql) res = commSql.ExecuteNonQuery End Sub Private Sub Form1_Load(sender As Object, e As EventArgs)Handles MyBase.Load End Sub Private Sub Button4_Click(sender As Object, e, As EventArgs) Handles Button4 .Click cadena = InputBox(Ingresa el Numero de Control) conectarSql() SQL= Select = from Alumnos Where noControl = + cadena + commSQL = New SqlCommand(SQL, conSql) drSql = commSql.ExecuteReader

if drSql.Read Then tNc.Text = drSql (0) tNom.Text =drSql (1) tAp.Text = drSql (2) tAm.Text = drSql (3) End If End Sub End Class

You might also like