Hi,
Having troubles with the conversion of date in a textbox i think.... currently txtDate.text has the date format of dd/mm/yyyy and im trying to grab data from the database that is equal to that date and put it in a listview. Problem Im haivng is the conversion from MM/dd/yyyy and dd/MM/yyyy which is so damn frustrating. My access database has the format of dd/MM/yyyy and yet it won't retrieve the data needed
here is part of the code.....
If dtpSelection.Checked And dtpSelection2.Checked Then
MyConn = New ADODB.Connection
MyConn.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\MenuItems.mdb;")
MyConn.Open()
'MessageBox.Show(FormatDateTime(dtpSelection.Value.ToShortDateString))
MyRecSet = MyConn.Execute("SELECT Item_ID, ItemName, Price, Qty, Total, Description, OrderDate FROM trans2 where (((trans2.OrderDate) = #" & txtdate.Text & "#))")
Do Until MyRecSet.EOF
var = MyRecSet.Fields.Item("Item_ID").Value
var2 = MyRecSet.Fields.Item("ItemName").Value 'variable2 = MyRecSet.Fields.Item("column2").Value
var3 = MyRecSet.Fields.Item("Price").Value
var4 = MyRecSet.Fields.Item("Qty").Value
var5 = MyRecSet.Fields.Item("Total").Value
var6 = MyRecSet.Fields.Item("OrderDate").Value
var7 = MyRecSet.Fields.Item("Description").Value.ToString
' lvItems.Clear()
lvwItem2 = lvItems.Items.Add(var6)
lvwItem2.SubItems.Add(var)
lvwItem2.SubItems.Add(var2)
lvwItem2.SubItems.Add(var3)
lvwItem2.SubItems.Add(var4)
lvwItem2.SubItems.Add(var5)
lvwItem2.SubItems.Add(var7)
' Listbox2.AddItem(variable2)
MyRecSet.MoveNext()
Loop
MyConn.Close()
End If
the problem i think is that the the value inside txtdate.text was retrieve from another listview and was grabbed like this
txtdate.Text = slist.Text
any help would good thanks guys..... and ive tried these cdate, formatdatetime etc