Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2005, 12:51 PM
Authorized User
 
Join Date: Jun 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem reading datetime values

Hello,

I have a SqlServer database from where I display information in a asp.net page. I'm having problems reading a datetime column. Below, I show you my code. Please, if someone have a hint, don't be shy a tell me:)
Code:
        Dim format As New System.Globalization.CultureInfo("pt-PT", True)
        Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("pt-PT", True)

        SqlConFuncionarios.Open()
        Dim Novadata1 As String = Session("IS") & " 00:00:00"
        Dim INSEMANA As DateTime = System.DateTime.Parse(Novadata1, format, System.Globalization.DateTimeStyles.AllowLeadingWhite)
        Dim Novadata2 As String = Session("FS") & " 00:00:00"
        str1 = "SELECT  cod_fucnionario ,Fhoras_Data,Cod_Tipo_movimento,Hora ,minuto FROM FhoraS_Horas WHERE Cod_fucnionario = " & Session("cod_fun") & "  And ( fhoras_data >= '" & Session("IS") & "' and  fhoras_data <= '" & Session("FS") & "')  ORDER BY Fhoras_Data   asc"
        'str1 = "SELECT  cod_fucnionario ,Fhoras_Data,Cod_Tipo_movimento,Hora ,minuto FROM FhoraS_Horas WHERE (Cod_fucnionario = " & Session("cod_fun") & ")  And (fhoras_data BETWEEN CONVERT(DATETIME," & Session("IS") & " 00:00:00,102) and CONVERT(DATETIME," & Session("FS") & " 00:00:00,102)) ORDER BY Fhoras_Data asc"
        SqlCom1 = New SqlClient.SqlCommand(str1, SqlConFuncionarios)
        MydataReader1 = SqlCom1.ExecuteReader(CommandBehavior.CloseConnection)
        MydataReader1.Read()
        If MydataReader1.HasRows Then
            Do  'avança com o datareader até ao proximo registo
                DataDia = MydataReader1.GetValue(1)
...

end if
MydataReader1.Close()
thanks

Elisa

Elisa Resina
__________________
Elisa Resina





Similar Threads
Thread Thread Starter Forum Replies Last Post
Values from recordset lost after reading vanik.cz Classic ASP Databases 11 January 4th, 2008 07:36 AM
Reading asp.net controls values from javascript naidukap ASP.NET 1.0 and 1.1 Professional 3 October 27th, 2005 02:55 PM
Reading Values from Excel cell into VB 6 applicati pratlina Beginning VB 6 2 December 28th, 2004 08:28 AM
Reading Form values into PHP peteburford BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 August 20th, 2004 11:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.