Pergunta

So... Progressing with my foray in to SQLite with VB.Net using System.Data.SQLite and am trying to generate a GetDataBy... with the a TableAdapter with a WHERE clause on a date field and the value is passed via a parameter.

SELECT        ID, FileName, LastModified
FROM            Playlists
WHERE        (LastModified > @LastScanned)

Generating this using the DataSet editor and at runtime I can see in the debugger that the parameter is configured as a date field, but when the .Fill() method is called the resulting DataTable has no rows.

Using SQLite Administrator I can get the query to work if I pass the date as a string.

SELECT * FROM Playlists WHERE LastModified > '1601-01-01'

If I attempt to change the criteria to

WHERE        (LastModified > **'@LastScanned'**)

Then the DataSet editor returns an error stating: "*Cannot convert entry to valid date/time; TO_DATE function might be required.*"

So I'm stuck. An example of how to get this working would be much appreciated.

Cheers,

Roy

Foi útil?

Solução

So I decided to recreate the FillBy and GetDataBy methods in the DataSet editor and the problem went away.

Not sure what had changed, I had not touched the database structure in any way, but re-running the configure wizard solved the problem!

Cheers,

Roy

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top