ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Codigo BS

Margaritamolina14 de Febrero de 2015

991 Palabras (4 Páginas)150 Visitas

Página 1 de 4

Imports Microsoft.VisualBasic

Imports System.Data.SqlClient

Public Class Centro

Private _id As Integer

Private _nom As String

Private _inves As String

Private _fecha As String

Private _facultad As String

Private strSQL As String

Private strcadenaconexion As String = ConfigurationManager.ConnectionStrings("strConexion").ConnectionString

Private objConn As SqlConnection

Private abjComando As SqlCommand

Public Property identificacion As Integer

Get

Return _id

End Get

Set(ByVal value As Integer)

_id = value

End Set

End Property

Public Property nombre As String

Get

Return _nom

End Get

Set(ByVal value As String)

_nom = value

End Set

End Property

Public Property investigador As String

Get

Return _inves

End Get

Set(ByVal value As String)

_inves = value

End Set

End Property

Public Property fecha As String

Get

Return _fecha

End Get

Set(ByVal value As String)

_fecha = value

End Set

End Property

Public Property facultad As String

Get

Return _facultad

End Get

Set(ByVal value As String)

_facultad = value

End Set

End Property

Private Sub conectar()

objConn = New SqlConnection(strcadenaconexion)

End Sub

Public Sub cerrar()

Objconn.Close()

End Sub

Public Function grabarcentro() As Integer

strSQL = "Insert Into Centro_de_Investigacion(IdCentro, Nombre, Director, Fecha_creacion, Facultad) Values(" & identificacion & ",'" & nombre & "','" & investigador & "' , '" & fecha & "', '" & facultad & "')"

conectar()

Try

objConn.Open()

abjComando = New SqlCommand(strSQL, objConn)

grabarcentro = abjComando.ExecuteNonQuery

Catch ex As SqlException

MsgBox("Codigo errror" & ex.ErrorCode & " Mensaje de Error:" & ex.Message, MsgBoxStyle.Information, "Error")

Finally

cerrar()

End Try

Return grabarcentro

End Function

Public Function consultacentro(ByVal nom As Integer) As SqlDataReader

strSQL = "Select Nombre nombre From Centro_de_Investigacion " & "Where Nombre= " & nom

conectar()

Try

objConn.Open()

abjComando = New SqlCommand(strSQL, objConn)

consultacentro = abjComando.ExecuteReader

Catch ex As SqlException

MsgBox("Codigo errror" & ex.ErrorCode & " Mensaje de Error:" & ex.Message, MsgBoxStyle.Information, "Error")

Finally

End Try

Return consultacentro

End Function

Public Function consultarTodoscentro() As SqlDataReader

...

Descargar como (para miembros actualizados) txt (3 Kb)
Leer 3 páginas más »
Disponible sólo en Clubensayos.com