
18/03/2005, 17:10
|
| | Fecha de Ingreso: marzo-2005
Mensajes: 6
Antigüedad: 20 años Puntos: 0 | |
codigo del mensaje de error Imports System.Data.SqlClient
Imports System.Drawing.Imaging
Public Class admin
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents contenedor4 As System.Web.UI.WebControls.Label
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
Public strconn As String
Dim objConexion As SqlConnection 'DECLARO LA VARIABLE PARA LA CONEXION son globales
Dim objcomando2 As SqlDataAdapter
Dim objradiobox As New RadioButtonList()
Dim boton_aceptar2 As New Button()
Dim objdataset As DataSet
Dim datos As New TextBox()
Dim datos2 As New TextBox()
Dim objconexion2 As SqlConnection
Dim objcomando3 As SqlCommand
Dim objdatareader2 As SqlDataReader
Dim objdatareader1 As SqlDataReader
Dim inicio2 As String
Dim objlistbox_gerencias As New ListBox()
Dim btn_aceptar As New Button()
Dim btn_cancelar As New Button()
Dim btn_modificar As New Button()
Dim btn_nuevo As New Button()
#Region " Código generado por el Diseñador de Web Forms "
'El Diseñador de Web Forms requiere esta llamada.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: el Diseñador de Web Forms requiere esta llamada de método
'No lo modifique con el editor de código.
InitializeComponent()
strconn = "server=127.0.0.1;uid=servicio;pwd=servicio;databa se=prueba1"
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
contenedor4.Controls.Clear()
objConexion = New SqlConnection(strconn)
objConexion.Open() 'ABRIMOS LO QUE ES LA CONEXION
objcomando2 = New SqlDataAdapter("select * from Componentes", objConexion)
objdataset = New DataSet()
objcomando2.Fill(objdataset, "componentes")
'//////Inicio de la pagina/////////////
contenedor4.Text = "FAVOR DE SELECCIONAR UN ELEMENTO"
objradiobox.DataSource = objdataset.Tables("componentes")
objradiobox.DataTextField = "componentes" ' con estas opciones especifico los elementos a mostrar
objradiobox.DataValueField = "componentes" ' creo que tienen que llevar los dos por que uno es para el valor creo.
objradiobox.ID = "Seleccion"
objradiobox.DataBind() ' sirve para enlazar los datos
boton_aceptar2.Visible = False
datos.ID = "datos"
Button2.ID = "btn_modificar"
datos2.ID = "datos2"
datos2.Visible = False
datos.Visible = False
objdataset = Nothing
objConexion.Close()
objConexion = Nothing
objcomando2 = Nothing
objConexion = Nothing
btn_aceptar.Visible = True
btn_cancelar.Visible = False
btn_modificar.Visible = False
btn_nuevo.Visible = False
contenedor4.Controls.Add(datos2)
contenedor4.Controls.Add(datos)
contenedor4.Controls.Add(boton_aceptar2)
contenedor4.Controls.Add(objradiobox)
contenedor4.Controls.Add(btn_aceptar)
AddHandler btn_cancelar.Click, AddressOf hola
AddHandler boton_aceptar2.Click, AddressOf uno
End Sub
Private Sub hola(ByVal sender As System.Object, ByVal e As System.EventArgs)
Select Case objradiobox.SelectedIndex
Case 0
contenedor4.Text = "Ingrese Subsecretaria o Area equivalente"
datos.Text = "Campo requerido"
datos.Visible = True
boton_aceptar2.Visible = True
boton_aceptar2.Text = "dynamictextbox"
contenedor4.Controls.Add(boton_aceptar2)
contenedor4.Controls.Add(datos)
Case 1
Case Is <> 0
Response.Write("<script language='JavaScript'>window.alert(""FAVOR DE SELECCIONAR UN ELEMENTO"")</script>") ' este es un mensaje de alerta, SI COLOCO ESTA ALERTA EN ESTA PARTE Y COMO ES EL MISMO BOTON PARA AMBOS SIEMPRE APARECERA UN MENSAJE DE ERRO QUE SELECCIONE LOS ELEMENTOS A LO CUAL ESTA INCORRECTO.
End Select
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Select Case objradiobox.SelectedIndex
Case 0
contenedor4.Text = "Ingrese Subsecretaria o Area equivalente"
datos.Text = "Campo requerido"
datos.Visible = True
boton_aceptar2.Visible = True
boton_aceptar2.Text = "dynamictextbox"
contenedor4.Controls.Add(boton_aceptar2)
contenedor4.Controls.Add(datos)
Case 1
Case Is <> 0
Response.Write("<script language='JavaScript'>window.alert(""FAVOR DE SELECCIONAR UN ELEMENTO"")</script>") ' este es un mensaje de alerta, SI COLOCO ESTA ALERTA EN ESTA PARTE Y COMO ES EL MISMO BOTON PARA AMBOS SIEMPRE APARECERA UN MENSAJE DE ERRO QUE SELECCIONE LOS ELEMENTOS A LO CUAL ESTA INCORRECTO.
End Select
End Sub
Public Function valor_recuperado(ByRef valor As String)
Dim tb As TextBox
tb = CType(contenedor4.FindControl("datos"), TextBox)
valor = tb.Text.ToUpper
End Function
Private Sub uno(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim x As String
Call valor_recuperado(x)
datos2.Text = x
contenedor4.Controls.Add(datos2)
objconexion2 = New SqlConnection(strconn)
objconexion2.Open() 'ABRIMOS LO QUE ES LA CONEXION
objcomando3 = New SqlCommand("select NIVEL,Tipo_organigrama,hijo from clasificacion_organigrama1 C,MENU_ORGANIGRAMA1 X where C.padre1=x.PADRE2 and rtrim(C.padre1)='" & x & "' ORDER BY NIVEL,CONTADOR", objconexion2)
objdatareader2 = objcomando3.ExecuteReader()
If objdatareader2.Read = Nothing Then ' con esta se puede determinar si el datareader contiene elementos y esto me servira para agregar lo que es un nuevo elemento a alguna direccion no contemplada en el eorganigrama inicial
Response.Write("<script language='JavaScript'>window.alert(""NO CONTIENE ELEMENTOS"")</script>") ' este es un mensaje de alerta.
Else
While objdatareader2.Read()
inicio2 = objdatareader2.Item("hijo") ' en esta parte asigno lo que es un registro a la vez
objlistbox_gerencias.Items.Add(inicio2) ' con esto estoy llenado el listbox
contenedor4.Controls.Add(objlistbox_gerencias)
End While
End If
btn_cancelar.Visible = True
btn_modificar.Visible = True
btn_nuevo.Visible = True
btn_aceptar.Text = "Aceptar"
btn_cancelar.Text = "Cancelar"
btn_modificar.Text = "Modificar"
btn_nuevo.Text = "Nuevo"
contenedor4.Controls.Add(btn_aceptar)
contenedor4.Controls.Add(btn_cancelar)
contenedor4.Controls.Add(btn_modificar)
contenedor4.Controls.Add(btn_nuevo)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
contenedor4.Controls.Clear()
Dim x As String
Call valor_recuperado(x)
End Sub
End Class |