Aplicaiones Web Con Ado Net
Aplicaiones Web Con Ado Net
Aplicaiones Web Con Ado Net
RadioButton1
ASPxListBox1
GridView1
Label1
Procedimientos Almacenados:
CREATE PROC USPLISTADO_MESES
@CAD VARCHAR(30)
AS
IF(@CAD='Par')
BEGIN
SELECT DISTINCT DATENAME(MONTH,FECHAPEDIDO) AS MES
FROM PEDIDOS WHERE MONTH(FECHAPEDIDO)%2=0
END
ELSE IF(@CAD='Impar')
BEGIN
SELECT DISTINCT DATENAME(MONTH,FECHAPEDIDO) AS MES
FROM PEDIDOS WHERE MONTH(FECHAPEDIDO)%2=1
END
ELSE IF(@CAD='Todos')
BEGIN
SELECT DISTINCT DATENAME(MONTH,FECHAPEDIDO) AS MES
FROM PEDIDOS
END
GO
CREATE PROC USP_LISTADO_PEDIDOS
@MES VARCHAR(30)
AS
SELECT C.IDCLIENTE,NOMBRECOMPAÑIA,COUNT(P.IDPEDIDO) AS
[CANTIDAD PEDIDOS],SUM(PRECIOUNIDAD*CANTIDAD) AS TOTAL
FROM CLIENTES C,PEDIDOS P,[DETALLES DE PEDIDOS]OD
WHERE C.IDCLIENTE=P.IDCLIENTE AND OD.IDPEDIDO=P.IDPEDIDO
AND DATENAME(MONTH,FECHAPEDIDO) =@MES
GROUP BY C.IDCLIENTE,NOMBRECOMPAÑIA
GO
<connectionStrings>
<add name="cn" connectionString="Server=(local);Integrated
Security=SSPI;Database=Neptuno"/>
</connectionStrings
Codigo Fuente:
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Label1
Image1
LinkButton1
RepeatColumns: 3
RepeatDirection: Horizontal
Procedimientos Almacenados:
CREATE PROC USP_LISTADO_PRODUCTOS
AS
SELECT * FROM ARTICULOS
GO
<connectionStrings>
<add name="cn" connectionString="Server=(local);Integrated
Security=SSPI;Database=Neptuno"/>
</connectionStrings
Codigo Fuente:
Imports System.Data
Imports System.Data.SqlClient
Aplicación 2: Default3.aspx
Label1 Image1
ASPxRoundPanel2
LinkButton1
Gridview1
Codigo Fuente:
Imports System.Data
Imports System.Data.SqlClient
Partial Class Default3
Inherits System.Web.UI.Page
Dim cn As New SqlConnection(ConfigurationManager.ConnectionStrings("cn").ConnectionString)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Me.Load
If Not Page.IsPostBack Then
Dim cod As String = Request.QueryString("cod")
'Preguntando si el codigo esta vacio
If (cod = "") Then
Me.Response.Write("<a href='Default2.aspx'>Regresar Pagina Principal</a>")
Else
lblmensaje.Visible = False
Dim cmd As New SqlCommand("USP_LISTADO_CABE_PRODUCTO", cn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@ART_COD", SqlDbType.Char, 5).Value = cod
Dim da As New SqlDataAdapter(cmd)
Dim tbl As New DataTable
da.Fill(tbl)
lblproducto.Text = tbl.Rows(0)(1)
lblprecio.Text = tbl.Rows(0)(2)
Image1.ImageUrl = ".\Productos\" & tbl.Rows(0)(1) & ".jpg"
'AHORA MOSTRANDO EL DETALLE VENDIDO
Dim cmd1 As New SqlCommand("USP_LISTADO_PEDIDOS", cn)
cmd1.CommandType = CommandType.StoredProcedure
cmd1.Parameters.Add("@ART_COD", SqlDbType.Char, 5).Value = cod
Dim da1 As New SqlDataAdapter(cmd1)
Dim tbl1 As New DataTable
da1.Fill(tbl1)
End If
End Sub