|
Mostrar Temas
|
Páginas: [1] 2
|
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
|
|
|
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
|
|
|
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 interfazhttp://img13.imageshack.us/i/webfya.jpg/aki el codigo de sql go use master go if(DB_ID('parcialvidarteDelgad')is not null) drop database parcialvidarteDelgad go create database parcialvidarteDelgad go use parcialvidarteDelgad go create table tipopelicula( tipo varchar(14)primary key ) go insert tipopelicula values ('DRAMA') insert tipopelicula values ('Suspenso') insert tipopelicula values ('Terror') insert tipopelicula values ('CienciaFiccion') insert tipopelicula values ('Otros') go create table pelicula( id int identity primary key, nombre varchar(30)unique, tipo varchar(14)foreign key references tipopelicula, añof date, stock int ) go create proc listartipo(@tipo varchar(30)) as begin select * from pelicula where tipo =@tipo end go create proc registrar(@n varchar(30),@tipo varchar(14),@añof date,@stock int,@msj varchar(60)output) as begin if (exists(select * from pelicula where nombre =@n )) set @msj ='Ya existe pelicula' else begin insert into pelicula values(@n ,@tipo ,@añof ,@stock ) set @msj ='OK' end end GO create proc MODIFICAR(@id int,@n varchar(30),@tipo varchar(14),@añof date,@stock int,@msj varchar(60)output) as begin if (NOT exists(select * from pelicula where id =@id )) set @msj ='no existe pelicula' else begin update pelicula set nombre =@n ,tipo =@tipo ,añof=@añof ,stock =@stock where id =@id set @msj ='OK' end end go create proc buscar(@id int) as begin select * from pelicula where id =@id end go insert into pelicula values('Odisea','DRAMA','10/10/2010',18) go
Ahora el codigo en Vb nota: activamos en la venta de propiedad ispostback=true en la barra de propiedades del combobox o cbxtipo
Imports System.Data Imports System.Data.SqlClient Partial Class pagina1 Inherits System.Web.UI.Page Private con As New SqlConnection("Server=.;DataBase=parcialvidarteDelgad;Integrated Security=true") Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click Dim cmd As New SqlCommand Dim msj As String = "" Try abrir() cmd = New SqlCommand("registrar", con) cmd.CommandType = 4 With cmd.Parameters .AddWithValue("@n", txtn.Text) .AddWithValue("@tipo", cbxtipo.SelectedValue) .AddWithValue("@añof", CDate(txtaño.Text)) .AddWithValue("@stock", CInt(txtstock.Text)) .Add("@msj", SqlDbType.VarChar, 60).Direction = 2 End With cmd.ExecuteNonQuery() msj = cmd.Parameters("@msj").Value MsgBox(msj) Catch ex As Exception MsgBox(ex.Message) End Try cerrar() limpiar() End Sub Sub limpiar() txtaño.Text = "" txtid.Text = "" txtn.Text = "" txtstock.Text = "" End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then listartipos() End If End Sub Sub listartipos() Dim dt As New DataTable Dim da As SqlDataAdapter Try abrir() da = New SqlDataAdapter("select * from tipopelicula", con) da.Fill(dt) cbxtipo.DataValueField = "tipo" cbxtipo.DataTextField = "tipo" cbxtipo.DataSource = dt cbxtipo.DataBind() Catch ex As Exception MsgBox(ex.Message) End Try cerrar() End Sub Sub abrir() If con.State = 0 Then con.Open() End Sub Sub cerrar() If con.State = 1 Then con.Close() End Sub Protected Sub cbxtipo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbxtipo.SelectedIndexChanged Dim dt As New DataTable Dim da As SqlDataAdapter Try abrir() da = New SqlDataAdapter("listartipo", con) da.SelectCommand.CommandType = 4 da.SelectCommand.Parameters.AddWithValue("@tipo", cbxtipo.SelectedValue) da.Fill(dt) GridView1.DataSource = dt GridView1.DataBind() Catch ex As Exception MsgBox(ex.Message) End Try cerrar() End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim dt As New DataTable Dim da As SqlDataAdapter Try abrir() da = New SqlDataAdapter("buscar", con) da.SelectCommand.CommandType = 4 da.SelectCommand.Parameters.AddWithValue("@id", txtid.Text) da.Fill(dt) txtid.Text = dt.Rows(0).Item(0).ToString txtn.Text = dt.Rows(0).Item(1).ToString cbxtipo.Text = dt.Rows(0).Item(2).ToString txtaño.Text = dt.Rows(0).Item(3).ToString txtstock.Text = dt.Rows(0).Item(4).ToString Catch ex As Exception MsgBox(ex.Message) End Try cerrar() End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim cmd As New SqlCommand Dim msj As String = "" Try abrir() cmd = New SqlCommand("MODIFICAR", con) cmd.CommandType = 4 With cmd.Parameters .AddWithValue("@id", txtid.Text) .AddWithValue("@n", txtn.Text) .AddWithValue("@tipo", cbxtipo.SelectedValue) .AddWithValue("@añof", CDate(txtaño.Text)) .AddWithValue("@stock", CInt(txtstock.Text)) .Add("@msj", SqlDbType.VarChar, 60).Direction = 2 End With cmd.ExecuteNonQuery() msj = cmd.Parameters("@msj").Value MsgBox(msj) Catch ex As Exception MsgBox(ex.Message) End Try cerrar() limpiar() End Sub Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click limpiar() End Sub End Class
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 interfazhttp://img215.imageshack.us/i/interfazk.jpg/
_Luego mostraremos el codigo en SQL go use master go if(db_id('practicando')is not null) drop database practicando go create database practicando go use practicando go create table docente( dni char(8)primary key, n varchar(30)not null, ape varchar(30)not null, sexo char(1)not null check(sexo='M'or sexo='F'), edad tinyint) go create proc registrar(@dni char(8),@n varchar(30),@ape varchar(30), @sexo char(1),@edad tinyint,@msj varchar(60)output) as begin if(exists(select * from docente where dni=dni )) set @msj ='dni ya existe' ELSE BEGIN insert into docente values(@dni ,@n ,@ape ,@sexo ,@edad ) set @msj ='REGISTRADO OK' END end
_ahora el codigo en Vb Imports System.Data Imports System.Data.SqlClient Public Class Form1 Private con As New SqlConnection("Server=.;DataBase=practicando;Integrated Security=true") Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load rbtm.Checked = True listar() txtregistros.Text = DataGridView1.Rows.Count - 1 lblhora.Text = TimeOfDay End Sub Sub listar() Dim dt As New DataTable Dim da As SqlDataAdapter Try abrir() da = New SqlDataAdapter("select * from docente", con) da.Fill(dt) DataGridView1.DataSource = dt Catch ex As Exception : MsgBox(ex.Message) End Try cerrar() txtregistros.Text = DataGridView1.Rows.Count - 1 End Sub Sub abrir() If con.State = 0 Then con.Open() End Sub Sub cerrar() If con.State = 1 Then con.Close() End Sub Sub limpiar() txtape.Clear() TXTDNI.Clear() txtedad.Clear() txtnom.Clear() rbtm.Checked = True End Sub Private Sub btnregistrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnregistrar.Click Dim cmd As SqlCommand Dim msj As String = "" Try abrir() cmd = New SqlCommand("registrar", con) cmd.CommandType = 4 With cmd.Parameters .AddWithValue("@dni", TXTDNI.Text) .AddWithValue("@n", txtnom.Text) .AddWithValue("@ape", txtape.Text) If rbtm.Checked = True Then .AddWithValue("@sexo", "M") Else .AddWithValue("@sexo", "F") End If .AddWithValue("@edad", txtedad.Text) .Add("@msj", SqlDbType.VarChar, 60).Direction = 2 End With cmd.ExecuteNonQuery() msj = cmd.Parameters("@msj").Value MessageBox.Show(msj) Catch ex As Exception : MessageBox.Show(ex.Message) End Try cerrar() limpiar() listar() End Sub End Class
Ahora los q quieran hagan los 2 botones mas Tomar en cuenta que los proc de eliminar y modificar son similares al registrar
|
|
|
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 Public Class Form1 Private mouseOffset As Point Private isMouseDown As Boolean = False Button1_Click(boton) Me.Close() 'cierra el formulario End Sub Evento MouseDown Dim xOffset As Integer Dim yOffset As Integer If e.Button = MouseButtons.Left Then xOffset = -e.X - SystemInformation.FrameBorderSize.Width yOffset = -e.Y - SystemInformation.CaptionHeight - _ SystemInformation.FrameBorderSize.Height mouseOffset = New Point(xOffset, yOffset) isMouseDown = True End If End Sub Evento MouseMove If isMouseDown Then Dim mousePos As Point = Control.MousePosition mousePos.Offset(mouseOffset.X, mouseOffset.Y) Location = mousePos End If End Sub Evento MouseUp del formulario If e.Button = MouseButtons.Left Then isMouseDown = False End If End Sub Protected Overrides Sub OnPaint( _ ByVal e As System.Windows.Forms.PaintEventArgs) Dim shape As New System.Drawing.Drawing2D.GraphicsPath shape.AddEllipse(0, 0, Me.Width, Me.Height) Me.Region = New System.Drawing.Region(shape) End Sub End Class
bUENO asi +o - kedaria al ejecutarlo: FaciLiT0
|
|
|
|
|
|
|