S
seegoon
Hi to all.
I am pretty new to this stuff , so forgive me if I am asking the
obvious.
I am trying to extract some data from an Access database and am having
some trouble.
The SQL query that I am using (in VB.net) searches for products
depending on selected operator and a timespan.
The query works fine is my PC's system date setting is mm/dd/yyyy.
If I change it to dd/mm/yyyy the query does not return any info.
Here is the relevant code. I get the "timespan" from 2 sets of
comboboxes , that set the start and end date. ie: 21 June 2005 to 30
June 2005. The operator is also from a combobox.
-------------------------------------------------------------------
stday = Val(comStartday.SelectedItem)
stmnth = Val(comstartMnth.SelectedIndex + 1)
styr = Val(comstartyr.SelectedItem)
finday = Val(comfinday.SelectedItem)
finmnth = Val(comfinmnth.SelectedIndex + 1)
finyr = Val(comfinyr.SelectedItem)
Dim findate As DateTime = New Date(finyr, finmnth, finday, 23,
59, 59)
Dim stdate As DateTime = New Date(styr, stmnth, stday)
Dim getproducts As New OleDb.OleDbCommand("select
distinct(prod) from loginfo where oper = '" & comoperator.SelectedItem
& "' and DT >= # " & stdate & "# and DT <= #" & findate & "# ",
startup_form.mycon)
Hope you can work out what is going on there!!
The results of the query are used to populate a listbox(code not shown)
How can I make the code work on any system with any regional settings.
Thanks
Robin
I am pretty new to this stuff , so forgive me if I am asking the
obvious.
I am trying to extract some data from an Access database and am having
some trouble.
The SQL query that I am using (in VB.net) searches for products
depending on selected operator and a timespan.
The query works fine is my PC's system date setting is mm/dd/yyyy.
If I change it to dd/mm/yyyy the query does not return any info.
Here is the relevant code. I get the "timespan" from 2 sets of
comboboxes , that set the start and end date. ie: 21 June 2005 to 30
June 2005. The operator is also from a combobox.
-------------------------------------------------------------------
stday = Val(comStartday.SelectedItem)
stmnth = Val(comstartMnth.SelectedIndex + 1)
styr = Val(comstartyr.SelectedItem)
finday = Val(comfinday.SelectedItem)
finmnth = Val(comfinmnth.SelectedIndex + 1)
finyr = Val(comfinyr.SelectedItem)
Dim findate As DateTime = New Date(finyr, finmnth, finday, 23,
59, 59)
Dim stdate As DateTime = New Date(styr, stmnth, stday)
Dim getproducts As New OleDb.OleDbCommand("select
distinct(prod) from loginfo where oper = '" & comoperator.SelectedItem
& "' and DT >= # " & stdate & "# and DT <= #" & findate & "# ",
startup_form.mycon)
Hope you can work out what is going on there!!
The results of the query are used to populate a listbox(code not shown)
How can I make the code work on any system with any regional settings.
Thanks
Robin