elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales


  Mostrar Temas
Páginas: [1] 2
1  Programación / .NET (C#, VB.NET, ASP) / videos vb-c# con sql server . creacion de instalador. vb 2008 en: 24 Mayo 2014, 18:37 pm



video sql server - vb studio 2008
2  Sistemas Operativos / GNU/Linux / Visual c# en Linux en: 7 Marzo 2012, 16:03 pm
Quien me podria decir como puedo correr una aplicacion hecha en visual studio
2008 (C#) en linux.
se que se puede hacer con monodevelop pero tengo un problema al instalar
este software ya q no tengo experiencia en el manejo de linux (centos)
alguien que podria ser tan amable de pasarme un tutorial de instalacion de
dicho programa en linux .
gracias
3  Programación / Programación General / SUBNETEO en: 20 Agosto 2011, 17:09 pm
Alguien por hay no tendra una calculadora para subnetear
osea subnetting
4  Programación / Programación General / chat en visual studio 2005 en: 13 Julio 2011, 18:23 pm
Quisiera que alguien sea tan amable de explicarme como
se puede hacer un chat en visual studio o si tiene ejemplos mucho mejor
gracias de antemano .
5  Programación / PHP / servicio de correo en: 13 Julio 2011, 18:17 pm
Bueno ante todo Hola
quisiera saber si alguien posee ejemplos de como enviar mensajes de correo
desde una pagina hecha en php o jsp.

Ante todo les agradezco mucho
6  Foros Generales / Foro Libre / EXIGENCIAS DE SERVIDORES TIA/EIA , ISO , NFPA en: 5 Abril 2011, 23:12 pm
QUISIERA SABER CUALES SON LAS EXIGENCIAS TIA/EIA , ISO , NFPA
PARA LOGRAR UN DISEÑO CONFIABLE Y FUNCIONAL
DE UN SERVIDOR
SI ALGUIEN TUVIERA TUTOTIALES , O ALGUNA INFORMACION
AVER SI ME LA PUEDE PASAR

ATTE : GRACIAS
7  Programación / Desarrollo Web / ejercico asp con conexión a sql en: 18 Marzo 2011, 16:44 pm
_Este ejercicio consiste en registrar buscar y modificar datos que se encuentran en una base de datos

_utilizaremos Visual studio 2010
_Sql server 2008
_crearemos un nuevo sitio web
aki la interfaz

http://img13.imageshack.us/i/webfya.jpg/

aki el codigo de sql
Código
  1.  
  2. go
  3. use master
  4. go
  5. if(DB_ID('parcialvidarteDelgad')is not null)
  6. drop database parcialvidarteDelgad
  7. go
  8. create database parcialvidarteDelgad
  9. go
  10. use parcialvidarteDelgad
  11. go
  12. create table tipopelicula(
  13. tipo varchar(14)primary key
  14. )
  15. go
  16. insert tipopelicula values ('DRAMA')
  17. insert tipopelicula values ('Suspenso')
  18. insert tipopelicula values ('Terror')
  19. insert tipopelicula values ('CienciaFiccion')
  20. insert tipopelicula values ('Otros')
  21. go
  22.  
  23. create table pelicula(
  24. id int identity primary key,
  25. nombre varchar(30)unique,
  26. tipo varchar(14)foreign key references tipopelicula,
  27. of date,
  28. stock int
  29. )
  30. go
  31. create proc listartipo(@tipo varchar(30))
  32. as begin
  33. select * from pelicula where tipo =@tipo
  34. end
  35. go
  36. create proc registrar(@n varchar(30),@tipo varchar(14),@añof date,@stock int,@msj varchar(60)output)
  37. as begin
  38. if (exists(select * from pelicula where nombre =@n ))
  39. set @msj ='Ya existe pelicula'
  40. else
  41. begin
  42. insert into pelicula values(@n ,@tipo ,@añof ,@stock )
  43. set @msj ='OK'
  44. end
  45. end
  46. GO
  47. create proc MODIFICAR(@id int,@n varchar(30),@tipo varchar(14),@añof date,@stock int,@msj varchar(60)output)
  48. as begin
  49. if (NOT exists(select * from pelicula where id  =@id  ))
  50. set @msj ='no existe pelicula'
  51. else
  52. begin
  53. update pelicula set nombre =@n ,tipo =@tipo ,añof=@añof ,stock =@stock where id  =@id  
  54. set @msj ='OK'
  55. end
  56. end
  57. go
  58. create proc buscar(@id int)
  59. as begin
  60. select * from pelicula where id =@id
  61. end
  62. go
  63. insert into pelicula values('Odisea','DRAMA','10/10/2010',18)
  64. go
  65.  
  66.  

Ahora el codigo en Vb
nota: activamos en la venta de propiedad ispostback=true en la barra de propiedades del combobox o cbxtipo


Código
  1.  
  2. Imports System.Data
  3. Imports System.Data.SqlClient
  4. Partial Class pagina1
  5.    Inherits System.Web.UI.Page
  6.    Private con As New SqlConnection("Server=.;DataBase=parcialvidarteDelgad;Integrated Security=true")
  7.    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
  8.        Dim cmd As New SqlCommand
  9.        Dim msj As String = ""
  10.        Try
  11.            abrir()
  12.            cmd = New SqlCommand("registrar", con)
  13.            cmd.CommandType = 4
  14.            With cmd.Parameters
  15.                .AddWithValue("@n", txtn.Text)
  16.                .AddWithValue("@tipo", cbxtipo.SelectedValue)
  17.                .AddWithValue("@añof", CDate(txtaño.Text))
  18.                .AddWithValue("@stock", CInt(txtstock.Text))
  19.                .Add("@msj", SqlDbType.VarChar, 60).Direction = 2
  20.            End With
  21.            cmd.ExecuteNonQuery()
  22.            msj = cmd.Parameters("@msj").Value
  23.            MsgBox(msj)
  24.        Catch ex As Exception
  25.            MsgBox(ex.Message)
  26.        End Try
  27.        cerrar()
  28.        limpiar()
  29.    End Sub
  30.    Sub limpiar()
  31.        txtaño.Text = ""
  32.        txtid.Text = ""
  33.        txtn.Text = ""
  34.        txtstock.Text = ""
  35.    End Sub
  36.    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  37.        If Not IsPostBack Then
  38.            listartipos()
  39.        End If
  40.    End Sub
  41.    Sub listartipos()
  42.        Dim dt As New DataTable
  43.        Dim da As SqlDataAdapter
  44.        Try
  45.            abrir()
  46.            da = New SqlDataAdapter("select * from tipopelicula", con)
  47.            da.Fill(dt)
  48.            cbxtipo.DataValueField = "tipo"
  49.            cbxtipo.DataTextField = "tipo"
  50.            cbxtipo.DataSource = dt
  51.            cbxtipo.DataBind()
  52.        Catch ex As Exception
  53.            MsgBox(ex.Message)
  54.        End Try
  55.        cerrar()
  56.    End Sub
  57.    Sub abrir()
  58.        If con.State = 0 Then con.Open()
  59.    End Sub
  60.    Sub cerrar()
  61.        If con.State = 1 Then con.Close()
  62.    End Sub
  63.  
  64.  
  65.  
  66.  
  67.    Protected Sub cbxtipo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbxtipo.SelectedIndexChanged
  68.        Dim dt As New DataTable
  69.        Dim da As SqlDataAdapter
  70.        Try
  71.            abrir()
  72.            da = New SqlDataAdapter("listartipo", con)
  73.            da.SelectCommand.CommandType = 4
  74.            da.SelectCommand.Parameters.AddWithValue("@tipo", cbxtipo.SelectedValue)
  75.            da.Fill(dt)
  76.            GridView1.DataSource = dt
  77.            GridView1.DataBind()
  78.        Catch ex As Exception
  79.            MsgBox(ex.Message)
  80.        End Try
  81.        cerrar()
  82.    End Sub
  83.    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
  84.        Dim dt As New DataTable
  85.        Dim da As SqlDataAdapter
  86.        Try
  87.            abrir()
  88.            da = New SqlDataAdapter("buscar", con)
  89.            da.SelectCommand.CommandType = 4
  90.            da.SelectCommand.Parameters.AddWithValue("@id", txtid.Text)
  91.            da.Fill(dt)
  92.            txtid.Text = dt.Rows(0).Item(0).ToString
  93.            txtn.Text = dt.Rows(0).Item(1).ToString
  94.            cbxtipo.Text = dt.Rows(0).Item(2).ToString
  95.            txtaño.Text = dt.Rows(0).Item(3).ToString
  96.            txtstock.Text = dt.Rows(0).Item(4).ToString
  97.        Catch ex As Exception
  98.            MsgBox(ex.Message)
  99.        End Try
  100.        cerrar()
  101.    End Sub
  102.    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  103.        Dim cmd As New SqlCommand
  104.        Dim msj As String = ""
  105.        Try
  106.            abrir()
  107.            cmd = New SqlCommand("MODIFICAR", con)
  108.            cmd.CommandType = 4
  109.            With cmd.Parameters
  110.                .AddWithValue("@id", txtid.Text)
  111.                .AddWithValue("@n", txtn.Text)
  112.                .AddWithValue("@tipo", cbxtipo.SelectedValue)
  113.                .AddWithValue("@añof", CDate(txtaño.Text))
  114.                .AddWithValue("@stock", CInt(txtstock.Text))
  115.                .Add("@msj", SqlDbType.VarChar, 60).Direction = 2
  116.            End With
  117.            cmd.ExecuteNonQuery()
  118.            msj = cmd.Parameters("@msj").Value
  119.            MsgBox(msj)
  120.        Catch ex As Exception
  121.            MsgBox(ex.Message)
  122.        End Try
  123.        cerrar()
  124.        limpiar()
  125.    End Sub
  126.    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
  127.        limpiar()
  128.    End Sub
  129. End Class
  130.  

eso es todo espero que les haya servido
8  Programación / Ejercicios / Para los q empiezan y quieren practicar en: 18 Marzo 2011, 16:06 pm
Realizaremos un ejercio simple de conexión VB~SQL
el cual consistira en registrar,modificar y eliminar docentes desde vb
_utilizare visual studio 2010 y sql server 2008
_crearemos un nuevo proyecto de tipo formulario windows
aki la interfaz


http://img215.imageshack.us/i/interfazk.jpg/


_Luego mostraremos el codigo en SQL
 
Código
  1.  
  2. go
  3. use master
  4. go
  5. if(db_id('practicando')is not null)
  6. drop database practicando
  7. go
  8. create database practicando
  9. go
  10. use practicando
  11. go
  12. create table docente(
  13. dni char(8)primary key,
  14. n varchar(30)not null,
  15. ape varchar(30)not null,
  16. sexo char(1)not null check(sexo='M'or sexo='F'),
  17. edad tinyint)
  18. go
  19. create proc registrar(@dni char(8),@n varchar(30),@ape varchar(30),
  20. @sexo char(1),@edad tinyint,@msj varchar(60)output)
  21. as begin
  22. if(exists(select * from docente where dni=dni ))
  23. set @msj ='dni ya existe'
  24. ELSE
  25. BEGIN
  26. insert into docente values(@dni ,@n ,@ape ,@sexo ,@edad )
  27. set @msj ='REGISTRADO OK'
  28. END
  29. end
  30.  


_ahora el codigo en Vb

 
Código
  1.  
  2. Imports System.Data
  3. Imports System.Data.SqlClient
  4. Public Class Form1
  5.    Private con As New SqlConnection("Server=.;DataBase=practicando;Integrated Security=true")
  6.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.        rbtm.Checked = True
  8.        listar()
  9.        txtregistros.Text = DataGridView1.Rows.Count - 1
  10.        lblhora.Text = TimeOfDay
  11.    End Sub
  12.    Sub listar()
  13.        Dim dt As New DataTable
  14.        Dim da As SqlDataAdapter
  15.        Try
  16.            abrir()
  17.            da = New SqlDataAdapter("select * from docente", con)
  18.            da.Fill(dt)
  19.            DataGridView1.DataSource = dt
  20.        Catch ex As Exception : MsgBox(ex.Message)
  21.        End Try
  22.        cerrar()
  23.        txtregistros.Text = DataGridView1.Rows.Count - 1
  24.    End Sub
  25.    Sub abrir()
  26.        If con.State = 0 Then con.Open()
  27.    End Sub
  28.    Sub cerrar()
  29.        If con.State = 1 Then con.Close()
  30.    End Sub
  31.    Sub limpiar()
  32.        txtape.Clear()
  33.        TXTDNI.Clear()
  34.        txtedad.Clear()
  35.        txtnom.Clear()
  36.        rbtm.Checked = True
  37.    End Sub
  38.  
  39.    Private Sub btnregistrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnregistrar.Click
  40.        Dim cmd As SqlCommand
  41.        Dim msj As String = ""
  42.        Try
  43.            abrir()
  44.            cmd = New SqlCommand("registrar", con)
  45.            cmd.CommandType = 4
  46.            With cmd.Parameters
  47.                .AddWithValue("@dni", TXTDNI.Text)
  48.                .AddWithValue("@n", txtnom.Text)
  49.                .AddWithValue("@ape", txtape.Text)
  50.                If rbtm.Checked = True Then
  51.                    .AddWithValue("@sexo", "M")
  52.                Else
  53.                    .AddWithValue("@sexo", "F")
  54.                End If
  55.                .AddWithValue("@edad", txtedad.Text)
  56.                .Add("@msj", SqlDbType.VarChar, 60).Direction = 2
  57.            End With
  58.            cmd.ExecuteNonQuery()
  59.            msj = cmd.Parameters("@msj").Value
  60.            MessageBox.Show(msj)
  61.        Catch ex As Exception : MessageBox.Show(ex.Message)
  62.  
  63.        End Try
  64.        cerrar()
  65.        limpiar()
  66.        listar()
  67.    End Sub
  68. End Class
  69.  

Ahora los q quieran hagan los 2 botones mas
Tomar en cuenta que los proc de eliminar y modificar son similares al registrar
9  Programación / Java / Otra forma de conectar java~sql en: 25 Febrero 2011, 18:34 pm
quisiera saber si hay otra forma de conectar java con sql aparte
del ODBC.
Y quisiera saber si CON JNI TAMBIEN SE PUEDE
10  Programación / .NET (C#, VB.NET, ASP) / cambiar la forma normal de un formulario a circulo en: 23 Enero 2011, 19:26 pm
Ojala les sirva ^^
1_Abrimos visual studio 2008(es el q utilizo yo), creamos un nuevo proyecto de tipo
formulario windows bueno aki la interfaz:



2_AKI el

 
Código
  1. Public Class Form1
  2.  
  3.    Private mouseOffset As Point
  4.    Private isMouseDown As Boolean = False
  5.  
  6. Button1_Click(boton)
  7.        Me.Close()
  8.   'cierra el formulario
  9.    End Sub
  10.  
  11. Evento MouseDown
  12.  
  13.        Dim xOffset As Integer
  14.        Dim yOffset As Integer
  15.        If e.Button = MouseButtons.Left Then
  16.            xOffset = -e.X - SystemInformation.FrameBorderSize.Width
  17.            yOffset = -e.Y - SystemInformation.CaptionHeight - _
  18.                    SystemInformation.FrameBorderSize.Height
  19.            mouseOffset = New Point(xOffset, yOffset)
  20.            isMouseDown = True
  21.        End If
  22.    End Sub
  23.  
  24. Evento MouseMove
  25.  
  26.        If isMouseDown Then
  27.            Dim mousePos As Point = Control.MousePosition
  28.            mousePos.Offset(mouseOffset.X, mouseOffset.Y)
  29.            Location = mousePos
  30.        End If
  31.    End Sub
  32.  
  33. Evento  MouseUp del formulario
  34.        If e.Button = MouseButtons.Left Then
  35.            isMouseDown = False
  36.        End If
  37.    End Sub
  38.  
  39.    Protected Overrides Sub OnPaint( _
  40.       ByVal e As System.Windows.Forms.PaintEventArgs)
  41.        Dim shape As New System.Drawing.Drawing2D.GraphicsPath
  42.        shape.AddEllipse(0, 0, Me.Width, Me.Height)
  43.        Me.Region = New System.Drawing.Region(shape)
  44.    End Sub
  45.  
  46.  
  47. End Class
  48.  
bUENO asi +o - kedaria al ejecutarlo:


FaciLiT0
 ;-)
Páginas: [1] 2
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines