473,654 Members | 3,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateTime in DataSet, want to display as Date (11/11/1111) type

I have an array being passed as a parameter to Crystal 9 (using vb .net in VS 2002). The listbox containing the dataset output at runtime shows DateTime format, but I want to only show mm/dd/yyyy format to the user. How is this accomplished? I changed the dataset type for the field to "Date" but it made no difference
Tks.
Nov 20 '05 #1
6 11345
Hi Helen,

There's no really good way to store a date. It is either free text or
date/time. (Not until the next edition of SQL Server will we have a
seperate date data type.)

Until then, you might want to keep the data as it is in the data set. Then,
in the binding's parse and format events, use the Format(myText, "Short
Date") function to format the list box items.

Hope this helps...

Eric

"Helen" <an*******@disc ussions.microso ft.com> wrote in message
news:79******** *************** ***********@mic rosoft.com...
I have an array being passed as a parameter to Crystal 9 (using vb .net in VS 2002). The listbox containing the dataset output at runtime shows
DateTime format, but I want to only show mm/dd/yyyy format to the user. How
is this accomplished? I changed the dataset type for the field to "Date"
but it made no difference. Tks.

Nov 20 '05 #2
Hi Helen,

Have a look at this.
http://msdn.microsoft.com/library/de...ormattopic.asp

I hope this helps?

Cor
Nov 20 '05 #3
Thanks, Eric and Cor, but I'm still not resolving this. Here's my code
Private Sub ConfigureCrysta lReports(
AReport = New A(
Dim myCrystalReport Viewer = CrystalReportVi ewer

Dim myArrayList As ArrayList = New ArrayList(
myArrayList.Add ("6/11/2001"
myArrayList.Add ("1/31/2001"

ListBox1.DataSo urce = GetDefaultValue sFromParameterF ield(AReport
SetCurrentValue sForParameterFi eld(A, myArrayList
myCrystalReport Viewer.ReportSo urce = ARepor

End Su

Private Sub SetCurrentValue sForParameterFi eld(ByVal myReportDocumen t As ReportDocument, ByVal myArrayList As ArrayList
Dim currentParamete rValues As ParameterValues = New ParameterValues (
Dim submittedValue As Objec
For Each submittedValue In myArrayLis
Dim myParameterDisc reteValue As ParameterDiscre teValue = New ParameterDiscre teValue(
myParameterDisc reteValue.Value = submittedValue. ToString(
currentParamete rValues.Add(myP arameterDiscret eValue
Nex

Dim myParameterFiel dDefinitions As ParameterFieldD efinitions = myReportDocumen t.DataDefinitio n.ParameterFiel d
Dim myParameterFiel dDefinition As ParameterFieldD efinition = myParameterFiel dDefinitions(PA RAMETER_FIELD_N AME
myParameterFiel dDefinition.App lyCurrentValues (currentParamet erValues
End Su

Private Function GetDefaultValue sFromParameterF ield(ByVal myReportDocumen t As ReportDocument) As ArrayLis
Dim myParameterFiel dDefinitions As ParameterFieldD efinitions = myReportDocumen t.DataDefinitio n.ParameterFiel d
Dim myParameterFiel dDefinition As ParameterFieldD efinition = myParameterFiel dDefinitions(PA RAMETER_FIELD_N AME
Dim defaultParamete rValues As ParameterValues = myParameterFiel dDefinition.Def aultValue

Dim myArrayList As ArrayList = New ArrayList(

Dim myParameterValu e As ParameterValu
For Each myParameterValu e In defaultParamete rValue
If (Not myParameterValu e.Kind.RangeVal ue) The
Dim myParameterDisc reteValue As ParameterDiscre teValue = CType(myParamet erValue, ParameterDiscre teValue
myArrayList.Add (myParameterDis creteValue.Valu e.ToString
End I
Nex
Return myArrayLis

End Functio

I'm not finding parse and format events for the bindings, Eric. How would I handle this
Thanks

Nov 20 '05 #4
Hi Helen,

I misreaded your message totally the firsttime,

Does this sample help you?

Cor
\\\
Dim dt As New DataTable("Hele n")
dt.Columns.Add( New DataColumn("Dat es", _
Type.GetType("S ystem.DateTime" )))
For i As Integer = 0 To 10
Dim dr As DataRow = dt.NewRow
dr("Dates") = CDate("01-01-2004").AddMonth s(i)
dt.Rows.Add(dr)
Next
MessageBox.Show (CDate(dt.Rows( 5)("Dates")).To String("MM-dd-yyyy"))
////
Nov 20 '05 #5
Hi, Cor:

I see this works, tks for the help. Can I bind a datatable to a listbox, just like a dataset, so then I can build your logic into the listbox?

I've started hardcoding the datasets and it seems more stable. I'd like to try your datatable concept.

Tks, Helen
Nov 20 '05 #6
Hi Helen,

Yes you can.
The listbox and combobox works both a little bit the same and I saw you
managed to do that, the both derive from listcontrol.

I hope this helps?

Cor
I see this works, tks for the help. Can I bind a datatable to a listbox, just like a dataset, so then I can build your logic into the listbox?

Nov 20 '05 #7

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

Similar topics

1
1295
by: John Cosmas | last post by:
I've encountered a table that stores dates in Gregorian format so that the dates and time looks like straight integers that cannot be easily discrened as a date or time by just looking at it. I'm using SQL to query the table and retrieve the data as an integer. I'm tyring to figure out how to best CAST or CONVERT the field into a DATE type so that its readable in the right format. I'm coding in VB.NET and the use of CDATE and FORMAT have...
1
3105
by: ABC | last post by:
How to convert a date string to datetime value with custom date format? e.g. Date String Date Format Result (DateTime value) "05/07/2004" "MM/dd/yyyy" May 7, 2004 "01062005" "ddMMyyyy" June 1, 2005 "09-07-05" "MM-dd-yy" Sept 7, 2005 Is there any functions to convert?
2
1643
by: Kiran | last post by:
Hi, Is it possible to display date in different languages depending upon the culture. Thanks Kiran
1
3277
by: Agnes | last post by:
I give up the 'dd-mm-yyyy' bindign question. However, how can i make the text box display date without time ??? Thank
1
1941
by: glenn | last post by:
Hi folks, I am doing an UPDATE to a table that has a field for a DATE data type. I am using MS Access. The UPDATE works fine but when I try to place the DATE field in the mix it blows up. The table name is rfi.
2
1772
sumaiya
by: sumaiya | last post by:
how can i display date subtraction
6
2987
by: dkyadav80 | last post by:
Hi guys, I have a form in html , all description below: first: name of persion (input type box) second: job profile (input type box) third: experience from: list box (Month : Jan, Feb,.. format) and experience to: list box (year: 2008,2007,2006,...) In Mysql database only 4 filed, 1. Name(data type - varchar),
1
9752
by: JFKJr | last post by:
Hello everyone, this one might be simple but driving me crazy! Your help will be greatly appreciated. Basically, I created a textbox bound to "Date" field in an Access VBA form. But when the field has date in "mm/dd/yyyy" format (for ex: 09/03/2008), the textbox displays it as 9/3/2008. Can anyone suggest how to display date in "mm/dd/yyyy" format in a bounded textbox. Thanks!
6
11432
by: gozdeata | last post by:
hey there, i m trying to get only time information of a date type variable. i got a column in type of char, it keeps time info in hh:mm format - 5 characters when i tried to convert it to date with to_date(, 'hh24:mi') it gives me a date starts with the ifrst day of current mount, year etc. 01/10/2008 14:04 for example. i need a solution to get time info in date data type from a char column in hh:mm thanx for ypur care...
0
8294
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8709
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8494
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8596
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7309
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1597
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.