Datagrid: date_time column only showing date part

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

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
 
Can you show us some vb.net code. It's probably a simple formatting problem
for your datacolumn.
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top