Conexion bd

Solo disponible en BuenasTareas
  • Páginas : 2 (431 palabras )
  • Descarga(s) : 0
  • Publicado : 12 de mayo de 2011
Leer documento completo
Vista previa del texto
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration

Public Class Estudiantes

Shared Function CrearEstudiante(ByVal nombre AsString, ByVal apellidos As String, ByVal sexo As Char) As Boolean
Dim SwExito As Boolean = True
Try
Dim objconexion As New SqlConnectionobjconexion.ConnectionString = ConfigurationManager.ConnectionStrings("ConexionSQL").ConnectionString
Dim objcomando As New SqlCommand
objcomando.Connection = objconexionobjcomando.CommandText = "SPINSEstudiantes"
objcomando.CommandType = CommandType.StoredProcedure
Dim objparametro1 As New SqlParameter("@Nombres", SqlDbType.VarChar, 50)objparametro1.Value = nombre
Dim objparametro2 As New SqlParameter("@Apellidos", SqlDbType.VarChar, 50)
objparametro2.Value = apellidos
Dim objparametro3 As NewSqlParameter("@Sexo", SqlDbType.Char, 1)
objparametro3.Value = sexo
objcomando.Parameters.Add(objparametro1)
objcomando.Parameters.Add(objparametro2)objcomando.Parameters.Add(objparametro3)
objconexion.Open()
objcomando.ExecuteNonQuery()
objconexion.Close()
Catch ex As Exception
SwExito =False
End Try
Return SwExito

End Function
Shared Sub ActualizarEstudiante(ByVal IdEst As Integer, ByVal nombre As String, ByVal apellidos As String _, ByVal sexo As Char, ByVal SwActivo As Boolean)
Try
Dim objconexion As New SqlConnection
objconexion.ConnectionString =ConfigurationManager.ConnectionStrings("ConexionSQL").ConnectionString
Dim objcomando As New SqlCommand
objcomando.Connection = objconexion
objcomando.CommandText = "SPUPDEstudiantes"...
tracking img