473,385 Members | 1,645 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,385 software developers and data experts.

datagrid data conversion

Hi,

I have a datagrid listing data from a database, and I am getting from the
database real value (it's actually represents a total of minutes).

What I want to do is Convert that number to a total of hours and minutes
like this:
on database: 70,5
on datagrid: 01:10:30

How can I do that conversion?
Nov 17 '05 #1
11 1513
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
Hi,

I have a datagrid listing data from a database, and I am getting from the
database real value (it's actually represents a total of minutes).

What I want to do is Convert that number to a total of hours and minutes
like this:
on database: 70,5
on datagrid: 01:10:30

How can I do that conversion?

Nov 17 '05 #2
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
Hi,

I have a datagrid listing data from a database, and I am getting from the
database real value (it's actually represents a total of minutes).

What I want to do is Convert that number to a total of hours and minutes
like this:
on database: 70,5
on datagrid: 01:10:30

How can I do that conversion?

Nov 17 '05 #3
That did not helpme to much I must get the values and do the calcs and them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
Hi,

I have a datagrid listing data from a database, and I am getting from the
database real value (it's actually represents a total of minutes).

What I want to do is Convert that number to a total of hours and minutes
like this:
on database: 70,5
on datagrid: 01:10:30

How can I do that conversion?


Nov 17 '05 #4
That did not helpme to much I must get the values and do the calcs and them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
Hi,

I have a datagrid listing data from a database, and I am getting from the
database real value (it's actually represents a total of minutes).

What I want to do is Convert that number to a total of hours and minutes
like this:
on database: 70,5
on datagrid: 01:10:30

How can I do that conversion?


Nov 17 '05 #5
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
That did not helpme to much I must get the values and do the calcs and
them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
> Hi,
>
> I have a datagrid listing data from a database, and I am getting from
> the
> database real value (it's actually represents a total of minutes).
>
> What I want to do is Convert that number to a total of hours and
> minutes
> like this:
> on database: 70,5
> on datagrid: 01:10:30
>
> How can I do that conversion?


Nov 17 '05 #6
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
That did not helpme to much I must get the values and do the calcs and
them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
> Hi,
>
> I have a datagrid listing data from a database, and I am getting from
> the
> database real value (it's actually represents a total of minutes).
>
> What I want to do is Convert that number to a total of hours and
> minutes
> like this:
> on database: 70,5
> on datagrid: 01:10:30
>
> How can I do that conversion?


Nov 17 '05 #7
Well I have the total minutes, for example 130,5 I need to divide it 60 to
get the hours value (in this example is 2) and then the mod to get (in this
example 10)...

Could you give me a hint in how to do it?

Thanks for your help and patience
"W.G. Ryan MVP" wrote:
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
That did not helpme to much I must get the values and do the calcs and
them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
> Hi,
>
> I have a datagrid listing data from a database, and I am getting from
> the
> database real value (it's actually represents a total of minutes).
>
> What I want to do is Convert that number to a total of hours and
> minutes
> like this:
> on database: 70,5
> on datagrid: 01:10:30
>
> How can I do that conversion?


Nov 17 '05 #8
Well I have the total minutes, for example 130,5 I need to divide it 60 to
get the hours value (in this example is 2) and then the mod to get (in this
example 10)...

Could you give me a hint in how to do it?

Thanks for your help and patience
"W.G. Ryan MVP" wrote:
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
That did not helpme to much I must get the values and do the calcs and
them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
> Hi,
>
> I have a datagrid listing data from a database, and I am getting from
> the
> database real value (it's actually represents a total of minutes).
>
> What I want to do is Convert that number to a total of hours and
> minutes
> like this:
> on database: 70,5
> on datagrid: 01:10:30
>
> How can I do that conversion?


Nov 17 '05 #9
Lets say I have this:
515.38977050 in the total minute... I can't retrieve the value do the
operations and and it to the other column.... I just need to convert a double
to a time format... :(

"W.G. Ryan MVP" wrote:
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
That did not helpme to much I must get the values and do the calcs and
them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
> Hi,
>
> I have a datagrid listing data from a database, and I am getting from
> the
> database real value (it's actually represents a total of minutes).
>
> What I want to do is Convert that number to a total of hours and
> minutes
> like this:
> on database: 70,5
> on datagrid: 01:10:30
>
> How can I do that conversion?


Nov 17 '05 #10
Lets say I have this:
515.38977050 in the total minute... I can't retrieve the value do the
operations and and it to the other column.... I just need to convert a double
to a time format... :(

"W.G. Ryan MVP" wrote:
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
That did not helpme to much I must get the values and do the calcs and
them
format the result....

"W.G. Ryan MVP" wrote:
You'll have to apply a DataGridTableStyle and then a DataGridColumnStyle,
you can format the column from there.
http://www.knowdotnet.com/articles/cgrid.html should help you.
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C6**********************************@microsof t.com...
> Hi,
>
> I have a datagrid listing data from a database, and I am getting from
> the
> database real value (it's actually represents a total of minutes).
>
> What I want to do is Convert that number to a total of hours and
> minutes
> like this:
> on database: 70,5
> on datagrid: 01:10:30
>
> How can I do that conversion?


Nov 17 '05 #11
In Sql Server, if you have the time in seconds, if you use this, it will
come in the grid formatted, otherwise I think you need to write some
formatting...

CONVERT(VARCHAR,DATEADD(s,ColumnName,'19000101'),8 ) AS 'Alias'
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:E3**********************************@microsof t.com...
Lets say I have this:
515.38977050 in the total minute... I can't retrieve the value do the
operations and and it to the other column.... I just need to convert a
double
to a time format... :(

"W.G. Ryan MVP" wrote:
Then create another datacolumn and do the computation in it. Unless your
computation is really complex then you should be able to do it with the
..Expression property
"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:C2**********************************@microsof t.com...
> That did not helpme to much I must get the values and do the calcs and
> them
> format the result....
>
> "W.G. Ryan MVP" wrote:
>
>> You'll have to apply a DataGridTableStyle and then a
>> DataGridColumnStyle,
>> you can format the column from there.
>> http://www.knowdotnet.com/articles/cgrid.html should help you.
>> "Diogo Alves - Software Developer"
>> <Di*************************@discussions.microsoft .com> wrote in
>> message
>> news:C6**********************************@microsof t.com...
>> > Hi,
>> >
>> > I have a datagrid listing data from a database, and I am getting
>> > from
>> > the
>> > database real value (it's actually represents a total of minutes).
>> >
>> > What I want to do is Convert that number to a total of hours and
>> > minutes
>> > like this:
>> > on database: 70,5
>> > on datagrid: 01:10:30
>> >
>> > How can I do that conversion?
>>
>>
>>


Nov 17 '05 #12

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

Similar topics

2
by: Mike Irwin | last post by:
I set up sorting by various columns for a DataGrid. For one of the columns, I would like to implement my own sort algorithm, though. For example, the column contains data like: <a...
1
by: ALI-R | last post by:
have a datagrid on a windows form which bound to a dataset ,one column contains boolean data which datagrid shows checkbox for it .I don't want checkbox ,instead I want "yes" or "no" and I want...
0
by: Diogo Alves - Software Developer | last post by:
Hi, I have a datagrid listing data from a database, and I am getting from the database real value (it's actually represents a total of minutes). What I want to do is Convert that number to a...
1
by: Patrick S. | last post by:
Hi, I wrote a small function, thaht converts a DataGrid to Excel from a Web-Application (C#). Running the function with 100-200 rows it just works fine. Starting a "special" Report produces a...
12
by: Daniel Walzenbach | last post by:
Hi, I want to display a Label in a DataGrid according to some condition. I therefore check whether the condition is true in the ItemDateBound EventHandler of the DataGrid. Unfortunately the...
4
by: Raghu Raman | last post by:
Hi, I want to load the images from my sqlserver200 db to the datagrid.I've seen a code from odetocode.com and it recreated to my wish. Database : Northwind;Table : from Employees , i want to...
1
by: RSB | last post by:
Hi Everyone, i am using the following code to transfer a DataGrid to Excel File. Every thing works ok beside the long numerice value like 0000121900000000 gets converted to 1.219E+11. how can i...
0
by: Tim::.. | last post by:
Hi... Can someone please tell me how I get the following values from the datatable below into a datagrid??? I want to use template columns so I can minipulate the data but don't know how to get...
1
by: Tim::.. | last post by:
Hi... Can someone please tell me how I get the following values from the datatable below into a datagrid??? I want to use template columns so I can minipulate the data but don't know how to get...
6
by: slinky | last post by:
I found the following code to transfer datagrid data to an Excel file. Is this written in C#?... I'm a vb.netter. I'm just not sure where to place the code to experiment on it. Should I place it in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.