PC Review


Reply
Thread Tools Rate Thread

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

 
 
=?Utf-8?B?SGVsZW4=?=
Guest
Posts: n/a
 
      19th May 2004
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.
 
Reply With Quote
 
 
 
 
Eric Lemmon
Guest
Posts: n/a
 
      19th May 2004
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" <(E-Mail Removed)> wrote in message
news:799C52E5-5795-43CF-A8FF-(E-Mail Removed)...
> 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.



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      19th May 2004
Hi Helen,

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

I hope this helps?

Cor


 
Reply With Quote
 
=?Utf-8?B?SGVsZW4=?=
Guest
Posts: n/a
 
      19th May 2004
Thanks, Eric and Cor, but I'm still not resolving this. Here's my code
Private Sub ConfigureCrystalReports(
AReport = New A(
Dim myCrystalReportViewer = CrystalReportViewer

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

ListBox1.DataSource = GetDefaultValuesFromParameterField(AReport
SetCurrentValuesForParameterField(A, myArrayList
myCrystalReportViewer.ReportSource = ARepor

End Su

Private Sub SetCurrentValuesForParameterField(ByVal myReportDocument As ReportDocument, ByVal myArrayList As ArrayList
Dim currentParameterValues As ParameterValues = New ParameterValues(
Dim submittedValue As Objec
For Each submittedValue In myArrayLis
Dim myParameterDiscreteValue As ParameterDiscreteValue = New ParameterDiscreteValue(
myParameterDiscreteValue.Value = submittedValue.ToString(
currentParameterValues.Add(myParameterDiscreteValue
Nex

Dim myParameterFieldDefinitions As ParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterField
Dim myParameterFieldDefinition As ParameterFieldDefinition = myParameterFieldDefinitions(PARAMETER_FIELD_NAME
myParameterFieldDefinition.ApplyCurrentValues(currentParameterValues
End Su

Private Function GetDefaultValuesFromParameterField(ByVal myReportDocument As ReportDocument) As ArrayLis
Dim myParameterFieldDefinitions As ParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterField
Dim myParameterFieldDefinition As ParameterFieldDefinition = myParameterFieldDefinitions(PARAMETER_FIELD_NAME
Dim defaultParameterValues As ParameterValues = myParameterFieldDefinition.DefaultValue

Dim myArrayList As ArrayList = New ArrayList(

Dim myParameterValue As ParameterValu
For Each myParameterValue In defaultParameterValue
If (Not myParameterValue.Kind.RangeValue) The
Dim myParameterDiscreteValue As ParameterDiscreteValue = CType(myParameterValue, ParameterDiscreteValue
myArrayList.Add(myParameterDiscreteValue.Value.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

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      20th May 2004
Hi Helen,

I misreaded your message totally the firsttime,

Does this sample help you?

Cor
\\\
Dim dt As New DataTable("Helen")
dt.Columns.Add(New DataColumn("Dates", _
Type.GetType("System.DateTime")))
For i As Integer = 0 To 10
Dim dr As DataRow = dt.NewRow
dr("Dates") = CDate("01-01-2004").AddMonths(i)
dt.Rows.Add(dr)
Next
MessageBox.Show(CDate(dt.Rows(5)("Dates")).ToString("MM-dd-yyyy"))
////


 
Reply With Quote
 
=?Utf-8?B?SGVsZW4=?=
Guest
Posts: n/a
 
      3rd Jun 2004
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
 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      4th Jun 2004
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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DateTime contains just Date when added to Dataset/Table Ron Microsoft Access 4 14th Oct 2004 10:56 PM
How to Filer DataSet on DateTime type. TusharP Microsoft Dot NET Framework Forms 1 26th Sep 2004 04:44 PM
Date vs. Datetime element in Dataset Bruce Microsoft Dot NET 1 12th Jan 2004 05:01 PM
convert datetime type to string type in a dataset? tom Microsoft ADO .NET 1 10th Dec 2003 08:28 AM
DateTime vs Date in DataSet moondaddy Microsoft ADO .NET 3 17th Oct 2003 02:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:56 AM.