在日期时间查询上使用vb.net和sqlserver时出现错误 [英] I am getting error while using vb.net and sqlserver on datetime query

查看:184
本文介绍了在日期时间查询上使用vb.net和sqlserver时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我们公司做一个项目.

在该项目中,我使用datetimepicker并连接了SQL Server2005.一切正常.几天后(从该日期到该日期)日期查询无法正常工作.我出错了.

请做有需要的

I am doing one project for our company.

In that project I used datetimepicker and I connected SQL Server 2005. Everything was working fine. Some day later (From this date to that date) date query is not working properly. I am getting error.

Kindly do the needful

推荐答案

可能是因为您仅在当月12日之后才出错,
如果正确的话,
在代码项目上插入或传递给sql时,使用日期格式,例如"YYYY-MM-DD"(即Convert(varchar(10),yourdate,121)).
Might be you are getting error only after 12th date of the month,
if this is correct then,
use the format of date like ''YYYY-MM-DD'' (i.e. Convert(varchar(10),yourdate,121) while inserting or passing it to sql.


在codeproject网站上有成千上万个如何解决问题的示例.使用搜索"窗口查找解决方案.

例如:> vb.net从数据库中选择日期和时间 [ ^ ]
On codeproject sites there are thousands of examples how to solve your problem. Use Search window to find the solution.

For example: vb.net date and time selection from database[^]


这篇关于在日期时间查询上使用vb.net和sqlserver时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆