17. april 2002 - 08:23Der er
11 kommentarer og 1 løsning
dato konvertering
jeg står og skal bruge en kommando der konvertere dette vb dato ( 16-04-02 07:17:37 ) til SQL ( 2001-08-17 15:06:49.000 ) jeg er rimelig ny til sql så der må gerne være lidt forklaring på forhånd tak
then it should work. You need to alter (DateField) to the name of the field in the table and DateTimeFieldFromVB to the name of the datetime variable in VB!
i have a vb application with a adodc control i connect to a sql server. i have 2 datepickers a start date and a end date the sql string will list the row with the rigt dates we will list in the datagrid the date is in a row named sd_dato and have this format 2001-08-17 15:06:49.000 my date pickker only returns 16-04-02 but i have a dtpicker as time too it returns 07:17:37 hope it is possible to understand...
Yes I can understand but I am not sure that I can explain exactly how to solve your problem!
DIM sSQL as STRING
sSQL = "SELECT * FROM YourTable WHERE TheDateField Between '" sSQL = sSQL & Format(dtPicker1Date, "YYYY-MM-DD") & " " & Format(dtPicker1Time, "hh:mm:ss") & "' AND " sSQL = sSQL & Format(dtPicker2Date, "YYYY-MM-DD") & " " & Format(dtPicker2Time, "hh:mm:ss") & "'"
Now you need to update the controls record source NOTE This IS just and example, you need to alter the name of the control (DataControl) to the name in your program
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.