el codigo es el siguiente
Código PHP:
Imports System.Data.SqlClient
Imports Cconexion
Partial Class _Default
Inherits System.Web.UI.Page
Dim conexion As New Cconexion
Dim dr As SqlDataReader
Sub cargacombo()
dr = Me.conexion.consultar("select c_id, c_campos From T_Identif")
While dr.Read()
Me.DDLIdentif.Items.Add(New ListItem(dr.Item("c_campos")))
End While
Me.DDLIdentif.DataMember = "c_campos"
End Sub
Protected Sub BtnAceptar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnAceptar.Click
Dim dr As SqlDataReader
dr = Me.conexion.consultar("select * From T_Alumnos where c_nombre = '" & Me.TxtUsuario.Text & "' and c_pass = '" & Me.TxtPass.Text & "'")
If dr.Read = False Then
Me.Lblresul.Text = "Este Administrador no está registrado"
Else
Me.Lblresul.Text = "Hola"
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.conexion = New Cconexion
cargacombo()
End Sub
Protected Sub DDLIdentif_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DDLIdentif.SelectedIndexChanged
Select Case Me.DDLIdentif.SelectedValue
Case "1"
Me.Lblresul.Text = "Esta seleccionado el administrador"
Case "2"
Me.Lblresul.Text = "Esta seleccionado el alumno"
End Select
End Sub
End Class
Código PHP:
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Imports System.Data.Sql
Public Class Cconexion
Public con As SqlConnection
Sub abrir()
If IsNothing(con) Then
con = New SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
con.Open()
End If
End Sub
Public Function ejecutar(ByVal orden As String) As Integer
abrir()
Dim cmd As New SqlCommand(orden, con)
Return cmd.ExecuteNonQuery
End Function
Public Function consultar(ByVal orden As String) As SqlDataReader
abrir()
Dim cmd As New SqlCommand(orden, con)
Return cmd.ExecuteReader
End Function
Public Function escalar(ByVal orden As String) As Object
abrir()
Dim cmd As New SqlCommand(orden, con)
Return cmd.ExecuteScalar
End Function
End Class