date time matching
-
had inserted datetime values in databse field like '" + DateTime.now + "' now i want to comapre valus using betwwen operator of SQL i.e where dbtime between '" + dtp1.value + "' AND '" + dtp2.value + "' but it does not show any record i think critera of where class did not match. how to compare them so that it show correct result Tasleem Arif
-
had inserted datetime values in databse field like '" + DateTime.now + "' now i want to comapre valus using betwwen operator of SQL i.e where dbtime between '" + dtp1.value + "' AND '" + dtp2.value + "' but it does not show any record i think critera of where class did not match. how to compare them so that it show correct result Tasleem Arif
Can you paste your code here? might be easy to help you that way. Difficult - > Challenging, this simple replacement made me take my life little easy;)
-
Can you paste your code here? might be easy to help you that way. Difficult - > Challenging, this simple replacement made me take my life little easy;)
str="INSERT INTO tblHistoryLog(UserId,UserAction,TableName,ActionDate,TrDoneOn) VALUES('" + CheckValues.strUserId + "','NEW RECORD','USER TABLE','" + DateTime.Now + "','" + cmbTAUserId.Text + "')"; where ActionDate datatype if datetime. i had inserted record in the table and inserted properly. the query that uses the comparison "SELECT * FROM tblHistoryLog WHERE (ActionDate BETWEEN #"+ dtpTo.Value +"# AND #"+ dtpFrom.Value +"#)" but it gives the no result i had tried to use this but it does not compile so i had to use above "+ #dtpTo.Value# +" AND "+ #dtpFrom.Value# +" Tasleem Arif
-
str="INSERT INTO tblHistoryLog(UserId,UserAction,TableName,ActionDate,TrDoneOn) VALUES('" + CheckValues.strUserId + "','NEW RECORD','USER TABLE','" + DateTime.Now + "','" + cmbTAUserId.Text + "')"; where ActionDate datatype if datetime. i had inserted record in the table and inserted properly. the query that uses the comparison "SELECT * FROM tblHistoryLog WHERE (ActionDate BETWEEN #"+ dtpTo.Value +"# AND #"+ dtpFrom.Value +"#)" but it gives the no result i had tried to use this but it does not compile so i had to use above "+ #dtpTo.Value# +" AND "+ #dtpFrom.Value# +" Tasleem Arif
-
What database are you using? What is the data type of the field in the database? --- b { font-weight: normal; } -- modified at 8:07 Saturday 8th July, 2006
-
str="INSERT INTO tblHistoryLog(UserId,UserAction,TableName,ActionDate,TrDoneOn) VALUES('" + CheckValues.strUserId + "','NEW RECORD','USER TABLE','" + DateTime.Now + "','" + cmbTAUserId.Text + "')"; where ActionDate datatype if datetime. i had inserted record in the table and inserted properly. the query that uses the comparison "SELECT * FROM tblHistoryLog WHERE (ActionDate BETWEEN #"+ dtpTo.Value +"# AND #"+ dtpFrom.Value +"#)" but it gives the no result i had tried to use this but it does not compile so i had to use above "+ #dtpTo.Value# +" AND "+ #dtpFrom.Value# +" Tasleem Arif
I assume that you are using either ASP.NET or windows forms as client. Try following: "ActionDate BETWEEN" & " '" & Convert.ToDateTime(dtpFrom.Value).ToLongDateString & "' AND " & " '" & Convert.ToDateTime(dtpTo.Text).ToLongDateString & "'" I also notice in your code, you are going from To...From! usually it is From...To right? Hope this helps. Difficult - > Challenging, this simple replacement made me take my life little easy;)