Gracias Matias, perono me ha funcionado me da el siguiente error:
No accessible overloaded 'String.Format' can be called without a narrow
ing conversion.
Description: An unhandled exception occurred during the execution of th
e current web request.
Please review the stack trace for more information about the error and
where it originated in the code
Igualmente esto me dejaria en la variable kk con formato string, creo.
Lo que quiero es que cuando haga el Datasource =3D Source
no me lo pase con formato smalldatetime sino con formato string.
kk =3D Source.Table.Rows.Item(i).Item("log_dat_start".ToString()). Con
esto tengo en la variable kk formato string pero me interesaria
convertir el Source, tambien he probado de hacer un Ctype() pero nada n
o he obtenido resultado
Gracias.
Date: 22/04/2002 18:06
To: "ASP.Net en Espa=F1ol" <aspx_espanol@p...>
Reply to: "ASP.Net en Espa=F1ol" <aspx_espanol@p...>
Subject: [aspx_espanol] RE: Convert Datetime to Char
Message text:
proba haciendo
kk =3D String.Format(Source.Table.Rows.Item(i).Item("log_dat_start"), "
{0:d}")
> -----Original Message-----
> From: Didac Lucas [mailto:didac.lucas@d...]
> Sent: lunes, 22 de abril de 2002 8:14
> To: ASP.Net en Espa=F1ol
> Subject: [aspx_espanol] Convert Datetime to Char
>
>
>
> Buenas el resultado de este dataset para el caso de log_dat_start
> es de datetime que es lo que obtiene de la salida del
> sql y querria pasarlo a char para que cuando me lo muestre en el
> dropdownlist no me salga 19/04/2002 0:00:00. o sea que querria
> 19/04/2002
>
>
> selected.DataTextField =3D DropDownList1.SelectedItem.Val
ue
>
> Dim myConnection As SqlConnection =3D New
> SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
>
> If (DropDownList1.SelectedItem.Value.ToString() =3D
> "log_dat_start") Then
> Str =3D "select DISTINCT (Convert(smalldatetime, "
> & DropDownList1.SelectedItem.Value.ToString() & ", 103)) As
> log_dat_start from FMLOGS order by 1 desc"
> Else
> Str =3D "Select DISTINCT (" &
> DropDownList1.SelectedItem.Value.ToString() & ") from FMLOGs"
> End If
>
> Dim MyCommand As SqlDataAdapter =3D New
> SqlDataAdapter(Str, myConnection)
> Dim DS As DataSet =3D New DataSet()
>
> MyCommand.Fill(DS, "FMLOGs")
>
> Dim Source As DataView =3D DS.Tables("FMLOGs").DefaultVie
w
>
> If ("log_dat_start" =3D
> DropDownList1.SelectedItem.Value.ToString()) Then
> Row =3D Source.Table.Rows.Count()
> For i =3D 0 To Row - 1
> kk =3D Source.Table.Rows.Item(i).Item("log_dat_st
art")
> Next
> End If
>
> selected.DataSource =3D Source
> selected.DataBind()
> selected.Visible =3D True
> datagrid1.Visible =3D False
> Response.Flush()
>
> Gracias
>
>
>
>
> --
>
> Diese E-Mail enth=E4lt vertrauliche und/oder rechtlich gesch=FCtzte
> Informationen. Wenn Sie nicht der richtige Adressat sind oder
> diese E-Mail irrt=FCmlich erhalten haben, informieren Sie bitte
> sofort den Absender und vernichten Sie diese Mail. Das unerlaubte
> Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestatt
et.
>
> This e-mail may contain confidential and/or privileged
> information. If you are not the intended recipient (or have
> received this e-mail in error) please notify the sender
> immediately and destroy this e-mail. Any unauthorized copying,
> disclosure or distribution of the material in this e-mail is
> strictly forbidden.
>
>
>
> ---
> Usted est=E1 suscrito a aspx_espanol como:
> woloski@s...
> Para darse de baja, env=EDe un mensaje en blanco a
> %%email.unsub%%
>
>
---
Usted est=E1 suscrito a aspx_espanol como:
didac.lucas@d...
Para darse de baja, env=EDe un mensaje en blanco a
%%email.unsub%%
to unsubscribe send a blank email to leave-aspx_espanol-477559V@p...
x.com.
--
Diese E-Mail enth=E4lt vertrauliche und/oder rechtlich gesch=FCtzte Inf
ormationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrt=FCmlich erhalten haben, informieren Sie bitte sofort den Absender
und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbef
ugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If
you are not the intended recipient (or have received this e-mail in err
or) please notify the sender immediately and destroy this e-mail. Any u
nauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.