Diferencia entre revisiones de «Conexión»
Apariencia
Contenido eliminado Contenido añadido
Sin resumen de edición |
Revertidos los cambios de Cosmico085 a la última edición de Davius usando monobook-suite |
||
Línea 10: | Línea 10: | ||
{{desambiguación}} |
{{desambiguación}} |
||
* |
|||
* |
|||
* |
|||
* |
|||
* |
|||
Module Conexion |
|||
Public cnn As SqlClient.SqlConnection |
|||
Public Function Consulta(ByVal Query As String, ByVal Tabla As String) As DataSet |
|||
Try |
|||
Dim daadConsulta As New SqlClient.SqlDataAdapter(Query, cnn) |
|||
Dim daseConsulta As New DataSet |
|||
daadConsulta.Fill(daseConsulta, Tabla) |
|||
Return daseConsulta |
|||
Catch ex As Exception |
|||
MsgBox("Error en" & ex.Message, MsgBoxStyle.Critical, "Error") |
|||
End Try |
|||
End Function |
|||
End Module |
|||
* |
|||
* |
|||
* |
|||
* |
|||
Public Class Login |
|||
' TODO: Insert code to perform custom authentication using the provided username and password |
|||
' (See http://go.microsoft.com/fwlink/?LinkId=35339). |
|||
' The custom principal can then be attached to the current thread's principal as follows: |
|||
' My.User.CurrentPrincipal = CustomPrincipal |
|||
' where CustomPrincipal is the IPrincipal implementation used to perform authentication. |
|||
' Subsequently, My.User will return identity information encapsulated in the CustomPrincipal object |
|||
' such as the username, display name, etc. |
|||
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click |
|||
Try |
|||
cnn = New SqlClient.SqlConnection("Server= NERY-C634FA85D1\SQLEXPRESS ; Database=Jonasa_Corp_2007_341;Uid=" & Me.txtusuario.Text & ";Pwd=" & Me.txtpassword.Text) |
|||
cnn.Open() |
|||
MsgBox("Bienvenido al Sistema", MsgBoxStyle.Information, "Jonasa Corp") |
|||
Me.Close() |
|||
Catch ex As Exception |
|||
MsgBox("Error en" & ex.Message, MsgBoxStyle.Critical, "Jonasa Corp") |
|||
Me.Close() |
|||
End Try |
|||
End Sub |
|||
Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
|||
End Sub |
|||
End Class |
|||
* |
|||
* |
|||
* |
|||
Public Class Form1 |
|||
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
|||
My.Forms.Login.MdiParent = Me |
|||
My.Forms.Login.Show() |
|||
End Sub |
|||
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click |
|||
My.Forms.Servicios.MdiParent = Me |
|||
My.Forms.Servicios.Show() |
|||
End Sub |
|||
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click |
|||
My.Forms.Puestos.MdiParent = Me |
|||
My.Forms.Puestos.Show() |
|||
End Sub |
|||
End Class |
|||
* |
|||
* |
|||
* |
|||
create table Especialidad |
|||
( |
|||
Codigo_Especialidad int auto_increment, |
|||
Especialidad varchar(32) not null, |
|||
Primary key (Codigo_Especialidad), |
|||
key k2 (Especialidad) |
|||
)Engine=Innodb; |
|||
create procedure Insertar_Especialidad (in Especialida varchar (32)) |
|||
begin |
|||
insert into Especialidad (Especialidad)values(Especialida); |
|||
end; |
|||
create procedure Modificar_Especialidad (in Codigo_Especialida int (10), Especialida varchar (32)) |
|||
begin |
|||
update Especialidad set Especialidad = Especialida where Codigo_Especialidad = Codigo_Especialida; |
|||
end; |
|||
create procedure Eliminar_Especialidad (in Codigo_Especialida int (10)) |
|||
begin |
|||
delete from Especialidad where Codigo_Especialidad = Codigo_Especialida; |
|||
end; |
|||
* |
|||
* |
|||
* |
|||
Create Table [dbo].[Servicios]( |
|||
Cod_Servicio Int Identity(1,1) Not For Replication Not Null Primary Key, |
|||
Descripcion Varchar(30) Not Null, |
|||
Precio Decimal(10,2) Not Null) |
|||
Go |
|||
create procedure insertar_servicios (@Descripcio varchar (30), @Preci decimal (10,2)) |
|||
as |
|||
insert into Servicios (Descripcion, Precio) values (@Descripcio, @Preci) |
|||
create procedure modificar_servicios (@Descripcio varchar (30), @Preci decimal (10,2), @Cod_Servici int) |
|||
as |
|||
update Servicios set Descripcion = @Descripcio, Precio = @Preci where Cod_Servicio = @Cod_Servici |
|||
create procedure eliminar_servicios (@Cod_Servici int) |
|||
as |
|||
delete from Servicios where Cod_Servicio = @Cod_Servici |
|||
* |
|||
* |
|||
* |
|||
Imports Microsoft.SqlServer |
|||
Imports System.Data |
|||
Public Class Agregar |
|||
Private Sub Cancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancelar.Click |
|||
Me.Close() |
|||
End Sub |
|||
Private Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click |
|||
Try |
|||
Dim execute As New SqlClient.SqlCommand("execute insertar_servicios '" & Me.txtdescripcion.Text & "', " & Me.txtprecio.Text & "; ", cnn) |
|||
execute.ExecuteNonQuery() |
|||
MsgBox("Datos Almacenados", MsgBoxStyle.Information, "Jonasa Corp") |
|||
Me.Close() |
|||
Catch ex As Exception |
|||
MsgBox("Error en" & ex.Message, MsgBoxStyle.Critical, "Jonasa Corp") |
|||
End Try |
|||
End Sub |
|||
End Class |
|||
-- |
|||
Public Class Modificar |
|||
Private Sub Cancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancelar.Click |
|||
Me.Close() |
|||
End Sub |
|||
Private Sub Guardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Guardar.Click |
|||
Try |
|||
Dim execute As New SqlClient.SqlCommand("execute modificar_servicios '" & Me.txtdescripcion.Text & "', " & Me.txtprecio.Text & ", '" & My.Forms.Servicios.codserviciotxt.Text & "';", cnn) |
|||
execute.ExecuteNonQuery() |
|||
MsgBox("Datos Modificados", MsgBoxStyle.Information, "Jonasa Corp") |
|||
Me.Close() |
|||
Catch ex As Exception |
|||
MsgBox("Error en" & ex.Message, MsgBoxStyle.Critical, "Jonasa Corp") |
|||
End Try |
|||
End Sub |
|||
Private Sub Modificar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
|||
Me.txtdescripcion.Text = My.Forms.Servicios.descripciontxt.Text |
|||
Me.txtprecio.Text = My.Forms.Servicios.preciotxt.Text |
|||
End Sub |
|||
End Class |
|||
* |
|||
* |
|||
* |
|||
Imports Microsoft.Office.Interop.Excel |
|||
Imports System.Data |
|||
Public Class Servicios |
|||
Public dsservicios As New DataSet |
|||
Public dservicios As New DataSet |
|||
Public fila As Integer = 0 |
|||
Public datos() As String |
|||
Public datos1() As String |
|||
Public datos2() As String |
|||
Public Sub Reporte() |
|||
Dim excelservicios As Application |
|||
excelservicios = New Application |
|||
Dim hojaexcel As Microsoft.Office.Interop.Excel.Worksheet |
|||
excelservicios.Workbooks.Add("C:\Jonasa\Servicios.xls") |
|||
excelservicios.Sheets("Servicios").select() |
|||
hojaexcel = excelservicios.ActiveSheet |
|||
Dim dsservicios As New DataSet |
|||
dservicios = Consulta("Select Servicios.Descripcion, Servicios.Precio from Servicios", "Servicios") |
|||
Dim fila As Integer = 0 |
|||
For Each registro As DataRow In dsservicios.Tables("Servicios").Rows |
|||
hojaexcel.Range("B" & 20 + fila).Value = registro.Item(0) |
|||
hojaexcel.Range("C" & 20 + fila).Value = registro.Item(1) |
|||
fila += 1 |
|||
Next |
|||
excelservicios.Visible = True |
|||
excelservicios.DisplayAlerts = False |
|||
End Sub |
|||
Public Sub Eliminar() |
|||
'actualizar() |
|||
Try |
|||
Dim resultado As MsgBoxResult |
|||
resultado = MsgBox("Desea eliminar el registro", MsgBoxStyle.YesNo, "Jonasa Corp") |
|||
If resultado = MsgBoxResult.Yes Then |
|||
Dim delete As New SqlClient.SqlCommand("execute eliminar_servicios '" & Me.codserviciotxt.Text & "';", cnn) |
|||
delete.ExecuteNonQuery() |
|||
MsgBox("Datos Eliminados", MsgBoxStyle.Information, "Jonasa Corp") |
|||
Else |
|||
MsgBox("Solicitud Anulada", MsgBoxStyle.Information, "Especialidad") |
|||
End If |
|||
Catch ex As Exception |
|||
End Try |
|||
End Sub |
|||
'Public Sub actualizar() |
|||
' fila = 0 |
|||
' Dim dservicios As New SqlClient.SqlDataAdapter |
|||
' dservicios = New SqlClient.SqlDataAdapter("select * from servicios", cnn) |
|||
' dsservicios = New DataSet |
|||
' dservicios.Fill(dsservicios, "servicios") |
|||
' ReDim datos(dsservicios.Tables("Servicios").Rows.Count - 1) |
|||
' ReDim datos1(dsservicios.Tables("Servicios").Rows.Count - 1) |
|||
' ReDim datos2(dsservicios.Tables("Servicios").Rows.Count - 1) |
|||
' Me.cantidadtxt.Text = dsservicios.Tables("servicios").Rows.Count |
|||
' For Each registros As DataRow In dsservicios.Tables("Servicios").Rows |
|||
' datos(fila) = registros.Item(0) |
|||
' datos1(fila) = registros.Item(1) |
|||
' datos2(fila) = registros.Item(2) |
|||
' fila += 1 |
|||
' Next |
|||
'End Sub |
|||
Private Sub Servicios_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown |
|||
If e.KeyData = Keys.Control + Keys.A Then |
|||
My.Forms.Agregar.ShowDialog() |
|||
End If |
|||
If e.KeyData = Keys.Control + Keys.M Then |
|||
My.Forms.Modificar.ShowDialog() |
|||
End If |
|||
If e.KeyData = Keys.Control + Keys.E Then |
|||
Eliminar() |
|||
End If |
|||
If e.KeyData = Keys.Control + Keys.R Then |
|||
Reporte() |
|||
End If |
|||
End Sub |
|||
Private Sub Servicios_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load |
|||
Dim dservicios As New SqlClient.SqlDataAdapter |
|||
dservicios = New SqlClient.SqlDataAdapter("select * from servicios", cnn) |
|||
dsservicios = New DataSet |
|||
dservicios.Fill(dsservicios, "servicios") |
|||
ReDim datos(dsservicios.Tables("Servicios").Rows.Count - 1) |
|||
ReDim datos1(dsservicios.Tables("Servicios").Rows.Count - 1) |
|||
ReDim datos2(dsservicios.Tables("Servicios").Rows.Count - 1) |
|||
Me.cantidadtxt.Text = dsservicios.Tables("servicios").Rows.Count |
|||
For Each registros As DataRow In dsservicios.Tables("Servicios").Rows |
|||
datos(fila) = registros.Item(0) |
|||
datos1(fila) = registros.Item(1) |
|||
datos2(fila) = registros.Item(2) |
|||
fila += 1 |
|||
Next |
|||
Me.codserviciotxt.Text = datos(0) |
|||
Me.descripciontxt.Text = datos1(1) |
|||
Me.preciotxt.Text = datos2(2) |
|||
End Sub |
|||
Private Sub atras_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles atras.Click |
|||
'actualizar() |
|||
For a = 0 To fila - 1 |
|||
If datos(a) = Me.codserviciotxt.Text And a > 0 Then |
|||
Me.codserviciotxt.Text = datos(a - 1) |
|||
Me.descripciontxt.Text = datos1(a - 1) |
|||
Me.preciotxt.Text = datos2(a - 1) |
|||
Exit Sub |
|||
End If |
|||
Next |
|||
End Sub |
|||
Private Sub cerrar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cerrar.Click |
|||
Me.Close() |
|||
End Sub |
|||
Private Sub adelante_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles adelante.Click |
|||
'actualizar() |
|||
For a = 0 To fila - 1 |
|||
If datos(a) = Me.codserviciotxt.Text And a < fila - 1 Then |
|||
Me.codserviciotxt.Text = datos(a + 1) |
|||
Me.descripciontxt.Text = datos1(a + 1) |
|||
Me.preciotxt.Text = datos2(a + 1) |
|||
Exit Sub |
|||
End If |
|||
Next |
|||
End Sub |
|||
Private Sub ultimo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ultimo.Click |
|||
'actualizar() |
|||
For a = 0 To fila - 1 |
|||
If datos(a) = Me.codserviciotxt.Text And fila - 1 <> a Then |
|||
Me.codserviciotxt.Text = datos(fila - 1) |
|||
Me.descripciontxt.Text = datos1(fila - 1) |
|||
Me.preciotxt.Text = datos2(fila - 1) |
|||
Exit Sub |
|||
End If |
|||
Next |
|||
End Sub |
|||
Private Sub primero_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles primero.Click |
|||
'actualizar() |
|||
For a = 0 To fila - 1 |
|||
If datos(a) = Me.codserviciotxt.Text And a > 0 Then |
|||
Me.codserviciotxt.Text = datos(0) |
|||
Me.descripciontxt.Text = datos1(0) |
|||
Me.preciotxt.Text = datos2(0) |
|||
Exit Sub |
|||
End If |
|||
Next |
|||
End Sub |
|||
End Class |
Revisión del 22:23 8 ene 2010
El término conexión puede referirse a:
- En matemáticas, la conexión es una manera de especificar la diferenciación covariante en una variedad diferenciable. También puede referirse a la conexidad de un espacio topológico.
- Conexión fue un programa producido y transmitido por MTV Latinoamérica entre 2000 y 2002.
- En telecomunicaciones, se refiere al enlace que se establece entre el emisor y el receptor a través del que se envía el mensaje. Comunmente puede referirese al tipo de enlace: ¿Cuál es tu conexión? ADSL, Red telefónica conmutada o RTB, RDSI, etc.
- El Ford Connect, un modelo de automóvil del fabricante estadounidense Ford Motor Company.