Dim loCommand As IDbCommand = Nothing Dim loConnection As IDbConnection = Nothing Dim loDataAdapter As IDbDataAdapter = Nothing Dim loDataParameter As IDbDataParameter = Nothing Dim loDataSet As DataSet = New DataSet Dim loODBCDataParameter As OdbcParameter = Nothing ' Create the ODBC connection loConnection = New OdbcConnection("...") ' Open the connection loConnection.Open() ' Command loCommand = New OdbcCommand loCommand.Connection = loConnection loCommand.CommandText = "Select Last_Date From RO Where Last_Date>@Last_Date" ' ODBC parameter loODBCDataParameter = New OdbcParameter() loODBCDataParameter.ParameterName = "Last_Date" loODBCDataParameter.Value = Date.Now loODBCDataParameter.DbType = DbType.Date ' Add the parameter loCommand.Parameters.Add(loODBCDataParameter) ' Data adapter loDataAdapter = New OdbcDataAdapter() loDataAdapter.SelectCommand = loCommand loDataAdapter.Fill(loDataSet)If I remove the Where clause, it works. Just to be sure that it works as is, the following works from ISQL:
Select Last_Date From RO Where Last_Date>'2010-05-11'So, basically, as soon as I try to parameterize from code, it will always say that whatever is on the other side of the > character is not found.
Declare @Last_Date Date Set @Last_Date='2010-05-11' Select Last_Date From RO Where Last_Date>@Last_DateIt will work.