i am try to systemdate and rem_date compare but error message is "Incorrect Syntax near'='"

Dim adp As New SqlDataAdapter("select * from reminder", obcon.con)
            Dim dset As New DataSet
            datagridview1.DataSource = dset.Tables(0)
            Dim cmd As New SqlCommand("select rem_id,rem_hour,rem_min from reminder rem_date=" & Date.Now.Date.ToString & "", obcon.con)
            MsgBox("select rem_id,rem_hour,rem_min from reminder rem_date=" & Date.Now.Date.ToString & "")
            Dim dr As SqlDataReader = cmd.ExecuteReader()
            If dr.RecordsAffected <> 0 Then
                While dr.Read()
                    Dim s As String = dr.GetValue(1).ToString().Trim() & ":" & dr.GetValue(2).ToString().Trim()
                    Dim cs As String = Date.Now.Hour.ToString().Trim() & ":" & Date.Now.Minute.ToString().Trim()
                    '  MsgBox(s & " (((( " & cs)
                    If s = cs Then
                        'MsgBox(dr.GetValue(1) & ":" & dr.GetValue(2) & Date.Now.Hour.ToString() & Date.Now.Minute.ToString())
                    End If

in database rem_date stored in for example 29-02-2012 00:00:00 formate.

i cant understand your prob , please tell me , how you want to compare your date , in your mssql query , or in your form ,

What line is generating the error? And what is the structure of your database table? It might also help if we knew what type of database you are connecting to. For example, Microsoft SQL Server uses

select GETDATE()

to get the current date/time. You can use that right in the query instead of Date.Now.Date.ToString

Edited 4 Years Ago by Reverend Jim: n/a

This article has been dead for over six months. Start a new discussion instead.