开发者

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));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜