473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Datagrid: date_time column only showing date part

Hi,
First my apologies for double-posting but I am not sure wether this is a
VB.Net or TSQL problem.

I have the following problem:
I generate a T-SQL string in order to fill my Dataset and consecuently a
Datagrid.
However on the date_time column only the date part is showing : e.g.
2004-08-14

Instead of the date and the time: e.g. 2004-08-14 02:12:06

The *same* string run at the SQL Server's Query analyzer will give *both*
parts in the date-time column.

TIA for your help
-steve
Nov 21 '05 #1
4 2539
oj
Can you show us some vb.net code. It's probably a simple formatting problem
for your datacolumn.

--
-oj
"steve" <st***@here.com> wrote in message
news:9E*******************@weber.videotron.net...
Hi,
First my apologies for double-posting but I am not sure wether this is a
VB.Net or TSQL problem.

I have the following problem:
I generate a T-SQL string in order to fill my Dataset and consecuently a
Datagrid.
However on the date_time column only the date part is showing : e.g.
2004-08-14

Instead of the date and the time: e.g. 2004-08-14 02:12:06

The *same* string run at the SQL Server's Query analyzer will give *both*
parts in the date-time column.

TIA for your help
-steve

Nov 21 '05 #2
Thats probably the cause of the interface ADO.NET, it depends wheter you get
these values and cast it to ^what kind of .NET Type. If you could tell,
that´ll help us in sql server group.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---

"steve" <st***@here.com> schrieb im Newsbeitrag
news:9E*******************@weber.videotron.net...
Hi,
First my apologies for double-posting but I am not sure wether this is a
VB.Net or TSQL problem.

I have the following problem:
I generate a T-SQL string in order to fill my Dataset and consecuently a
Datagrid.
However on the date_time column only the date part is showing : e.g.
2004-08-14

Instead of the date and the time: e.g. 2004-08-14 02:12:06

The *same* string run at the SQL Server's Query analyzer will give *both*
parts in the date-time column.

TIA for your help
-steve

Nov 21 '05 #3
thank you OJ and Jens,

As i said I am not very familiar with either SQL Server nor ADO.NET except
the basics.

In the Ent. Manager interface my field is of type smalldatetime.

I cant really show you the code because its quite big and at various places,
however as I said:

1) I construct the SQL query as a sString. (this *same one* I copy and paste
from a textbox into the Query Analyzer and get the datetime *complete* with
the hour part)
2) I create a dataset and then bind it to a datagrid.

Of course the results agree and there is no problem except ... i miss the
hour part in the datagrid!
Maybe I should specify it on the SQL string itself.
BTW, i noticed the when i multiply two real valurs I get some weird result:
e.g. 0.1 X 2.34 = 0.234000005 , is this some kind of internal round off
error from the server? And, what is the simplest way to round values? I
currently use cast( .... as numeric (5,3)).
Is there a simpler way to get two decimals?

TIA again!!!
-steve

"Jens Süßmeyer" <Jens@Remove_this_For_Contacting.sqlserver2005.d e> a écrit
dans le message de news: uh*************@TK2MSFTNGP15.phx.gbl...
Thats probably the cause of the interface ADO.NET, it depends wheter you
get these values and cast it to ^what kind of .NET Type. If you could
tell, that´ll help us in sql server group.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---

"steve" <st***@here.com> schrieb im Newsbeitrag
news:9E*******************@weber.videotron.net...
Hi,
First my apologies for double-posting but I am not sure wether this is a
VB.Net or TSQL problem.

I have the following problem:
I generate a T-SQL string in order to fill my Dataset and consecuently a
Datagrid.
However on the date_time column only the date part is showing : e.g.
2004-08-14

Instead of the date and the time: e.g. 2004-08-14 02:12:06

The *same* string run at the SQL Server's Query analyzer will give *both*
parts in the date-time column.

TIA for your help
-steve


Nov 21 '05 #4
oj
Steve,

1. This is by design for datagrid. You want to take a look at this if you
want *custom* formatting.
http://msdn.microsoft.com/library/en...asp?frame=true

2. I get .234 for the result. Perhaps, you want to take a look at formatting
on the UI side.
http://msdn.microsoft.com/library/en...asp?frame=true
--
-oj
"steve" <st***@here.com> wrote in message
news:5K********************@weber.videotron.net...
thank you OJ and Jens,

As i said I am not very familiar with either SQL Server nor ADO.NET except
the basics.

In the Ent. Manager interface my field is of type smalldatetime.

I cant really show you the code because its quite big and at various
places, however as I said:

1) I construct the SQL query as a sString. (this *same one* I copy and
paste from a textbox into the Query Analyzer and get the datetime
*complete* with the hour part)
2) I create a dataset and then bind it to a datagrid.

Of course the results agree and there is no problem except ... i miss the
hour part in the datagrid!
Maybe I should specify it on the SQL string itself.
BTW, i noticed the when i multiply two real valurs I get some weird
result: e.g. 0.1 X 2.34 = 0.234000005 , is this some kind of internal
round off error from the server? And, what is the simplest way to round
values? I currently use cast( .... as numeric (5,3)).
Is there a simpler way to get two decimals?

TIA again!!!
-steve

"Jens Süßmeyer" <Jens@Remove_this_For_Contacting.sqlserver2005.d e> a écrit
dans le message de news: uh*************@TK2MSFTNGP15.phx.gbl...
Thats probably the cause of the interface ADO.NET, it depends wheter you
get these values and cast it to ^what kind of .NET Type. If you could
tell, that´ll help us in sql server group.

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---

"steve" <st***@here.com> schrieb im Newsbeitrag
news:9E*******************@weber.videotron.net...
Hi,
First my apologies for double-posting but I am not sure wether this is a
VB.Net or TSQL problem.

I have the following problem:
I generate a T-SQL string in order to fill my Dataset and consecuently a
Datagrid.
However on the date_time column only the date part is showing : e.g.
2004-08-14

Instead of the date and the time: e.g. 2004-08-14 02:12:06

The *same* string run at the SQL Server's Query analyzer will give
*both* parts in the date-time column.

TIA for your help
-steve



Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Simon | last post by:
Can any one please tell me how to set the width of my datagrid coloums after I have put them into edit mode? At the moment I bind the datagrid to a returning dataset; DataGrid1.DataSource =...
4
by: karunakar | last post by:
Hi All I was poplating Datagrid Datagrid has one of the column showing datetime field format iam showing DATE here not Necessary to populate the Time Frame Even my datebase column also...
0
by: JL3574 l | last post by:
i have a datagrid with a combo box added in it's columns . the combobox pulls values from a database in it's dropdownlist fashion. my problem is that when i pick a select on the combo box it...
5
by: AC | last post by:
Any reason i'm having trouble with: DataGrid1.Columns(7).ItemStyle.HorizontalAlign = HorizontalAlign.Right I'm trying to directly set the column alignment of a datagrid created at runtime.. ...
1
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems...
1
by: Reza | last post by:
Hi I have a column in my datagrid that can have values of null at times. I am not assigning any value to it, if it is coming from Database empty. Now, the problem is I guess the datetime variables...
4
by: yer darn tootin | last post by:
Does anyone know the sort expression for a column that's data has been returned in the format, eg '07 Jul 05'?? The sort expression {..:"dd mmm yy"} doesn't work ( if the column was returned as...
0
by: ufnuceda | last post by:
Hello everyone, I was wondering if any of you have some experience with the boost library. I am having trouble compiling code with it. Since boost is being used a lot these days I thought some...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.