Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Time Field to Label

Posted on 2011-09-13
2
Medium Priority
?
329 Views
Last Modified: 2012-05-12
Hi all,

I have a label, and I retrieve a value from the database that is a TIME field.

When assigning the value to the label as:

Label1.Text=rs(0)

I get the following error:

Conversion from type 'TimeSpan' to type 'String' is not valid.

I tried

Label1.text = CStr(RS(0))

But still not working.

Any help will be appreciated :)

Thanks!
0
Comment
Question by:pvg1975
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 36532210
rs(0) is a TimeSpan object, an it contains a lot of information.

You first need to decide with information you need:

rs(0).Minutes
rs(0).Days

and so on.

if you do not want to retrieve an exact value such as those, tell the variable to retrieve a String representation of what is inside the variable this way:

Label1.Text = rs(0).ToString
0
 

Author Closing Comment

by:pvg1975
ID: 36532242
Thanks James!

Im posting another question in the next 2 minutes (similar to this)

Thanks!
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question