Convert .NET datetime to SQlite datetime
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 .
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));
精彩评论