tags:

views:

43

answers:

1

I've tried to query with a datetime in C#, database : SQlite.

cmd.CommandText = @"select * from PhieuNhap where NgayNhap=$NgayNhap";
cmd.Parameters.Add(new SQLiteParameter("$NgayNhap", SqlDbType.DateTime).Value = ngayNhap;

ngayNhap is a DateTime type.

But it seems doesn't work this way .

+1  A: 

Do you get an exception or is the value just ignored?

One thing you could try is not setting the parameter type manually:

cmd.CommandText = @"select * from PhieuNhap where NgayNhap=$NgayNhap";
cmd.Parameters.Add(new SQLiteParameter("$NgayNhap", ngayNhap));
SchlaWiener