Retroceder   Foros del Web > Programación para sitios web > .NET

Respuesta
 
Herramientas Desplegado
Antiguo 16-abr-2008, 15:50   #1 (permalink)
roger1187 ha deshabilitado el karma
 
Fecha de Ingreso: marzo-2008
Mensajes: 148
duda en asp.net con dreamweaver

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="utf-8" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicK eyToken=836f606ede05d46a,culture=neutral" %>
<MM:Insert
runat="server"
CommandText='<%# "INSERT INTO dbo.fecha (fecha) VALUES (@fecha)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_STRING_cn1") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSett ings("MM_CONNECTION_DATABASETYPE_cn1") %>'
Expression='<%# Request.Form("MM_insert") = "Prueba" %>'
CreateDataSet="false"
Debug="true"
>
<Parameters>
<Parameter Name="@fecha" Value='<%# IIf((Request.Form("txtFecha") <> Nothing), Request.Form("txtFecha"), "") %>' Type="DateTime" />
</Parameters>
</MM:Insert>
<MM:PageBind runat="server" PostBackBind="true" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="vb" runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
If Not IsPostBack
RellenarDDLYears()
ddlYear.SelectedValue = Date.Now.Year

RellenarDDLMonths()
ddlMonth.SelectedIndex = Date.Now.Month - 1

RellenarDDLDays(ddlMonth.SelectedIndex + 1)
ddlDay.SelectedValue = Date.Now.Day
End If

txtFecha.Text = ddlDay.SelectedValue &"/"& ddlMonth.SelectedValue &"/"& ddlYear.SelectedValue
End Sub

Sub Cambia_Mes(sender as Object, e As EventArgs)
Session("ssDaySelected") = ddlDay.SelectedIndex
RellenarDDLDays(sender.SelectedIndex + 1)
End Sub

Sub RellenarDDLDays(ipMes As Integer)
ddlDay.Items.Clear()
Dim endDayNumber, i As Integer
If ipMes.Equals(1) Or ipMes.Equals(3) Or ipMes.Equals(5) Or ipMes.Equals(7) Or ipMes.Equals(8) Or ipMes.Equals(10) Or ipMes.Equals(12)
endDayNumber = 31
Else If ipMes.Equals(4) Or ipMes.Equals(6) Or ipMes.Equals(9) Or ipMes.Equals(11)
endDayNumber = 30
Else
endDayNumber = 28
End If
For i = 1 To endDayNumber
ddlDay.Items.Add(i)
ddlDay.DataValueField = i
ddlDay.DataTextField = i
Next

If Not Session("ssDaySelected") Is Nothing Then
ddlDay.SelectedIndex = Convert.toInt32(Session("ssDaySelected"))
Session.Clear()
End If
End Sub

Sub RellenarDDLYears()
ddlYear.Items.Clear()
Dim i As Integer
For i = 1990 To 2100
ddlYear.Items.Add(i)
Next
End Sub

Sub RellenarDDLMonths()
ddlMonth.Items.Clear()
Dim Meses As String() = {"Enero","Febrero","Marzo","Abril","Mayo","Junio", "Julio","Agosto","Septiembre","Octubre","Noviembre ","Diciembre"}
Dim i As Integer
For i = 0 To Meses.Length()-1
ddlMonth.Items.Add(Meses(i))
ddlMonth.DataValueField = i
ddlMonth.DataTextField = Meses(i)
Next
End Sub
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
.Headers {
font-family: "Lucida Sans";
color: #990066;
font-size: 10pt;
text-align:center;
}

.DDLs {
font-family: "Lucida Sans";
color:#000099;
font-size: 8pt;
}
-->
</style>
</head>
<body>
<form method='POST' name='Prueba' id="Prueba" runat='server'>
<table width="200" border="0" cellspacing="5">
<tr>
<td class="Headers">Dia</td>
<td class="Headers">Mes</td>
<td class="Headers">Año</td>
</tr>
<tr>
<td><asp:DropDownList ID="ddlDay" runat="server" CssClass="DDLs"></asp:DropDownList></td>
<td><asp:DropDownList ID="ddlMonth" runat="server" CssClass="DDLs" OnSelectedIndexChanged="Cambia_Mes"></asp:DropDownList></td>
<td><asp:DropDownList ID="ddlYear" runat="server" CssClass="DDLs"></asp:DropDownList></td>
</tr>

<tr>
<td colspan="3" align="center">
<asp:Label ID="lblFecha" Text="Fecha (Concatenación)" runat="server" CssClass="Headers" />
<br />
<asp:TextBox ID="txtFecha" runat="server" ReadOnly="true" CssClass="DDLs" Width="120" AutoPostBack="true"/>
<asp:Button ID="Button1" runat="server" /> </td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="Prueba">
</form>
</body>
</html>


kiero q me ayuden con 1 problema al insertar a mi tabla fecha...el unico campo es fecha....el problema es q al parecer se .....kiero insertar el archivo concatenado..... al parecer inserta 2 veces archivos...y la nueva fecha

espero q me ayuden
roger1187 está desconectado   Responder Citando
Antiguo 17-abr-2008, 10:29   #2 (permalink)
roger1187 ha deshabilitado el karma
 
Fecha de Ingreso: marzo-2008
Mensajes: 148
Re: duda en asp.net con dreamweaver

problema solucionado solo tuve q hacer 1os cambios a los parametros.....y a la concatenacion nada mas

fechaingreso = ddlDay.SelectedValue &"/"& ddlMonth.SelectedValue &"/"& ddlYear.SelectedValue

x

txtFecha.Text = ddlDay.SelectedValue &"/"& ddlMonth.SelectedValue &"/"& ddlYear.SelectedValue

y tb nombrar la variable fecha ingreso

dim fechaingreso as string



y en las variables tuve q cambiar los valores nada mas

<Parameters>
<Parameter Name="@fecha" Value='<%# IIf((fecha ingreso<> Nothing), fechaingreso), "") %>' Type="DateTime" />
</Parameters>


x

<Parameters>
<Parameter Name="@fecha" Value='<%# IIf((Request.Form("txtFecha") <> Nothing), Request.Form("txtFecha"), "") %>' Type="DateTime" />
</Parameters>


gracias jl.bautistac...y peterpay
roger1187 está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 23:42.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93