Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.Net日期时间SQL参数_Asp.net_Sql_Datetime - Fatal编程技术网

Asp.Net日期时间SQL参数

Asp.Net日期时间SQL参数,asp.net,sql,datetime,Asp.net,Sql,Datetime,我正在从SQL表中选择一些数据。表中有一列日期时间类型(SQL类型) 存储过程正在使用此 where CONVERT(varchar(10),post_tarihi,105)=@post_tarihi(event_date) 我有一个方法,它有一个参数,它是字符串类型(Asp.net类型) 当我从sql管理studio执行sp时,返回一些结果 但当我运行asp.net应用程序时,不会返回任何内容。 类型有问题吗 若你们问“为什么要用文本框来表示日期”,我之所以用是因为用了日期选择器(jq

我正在从SQL表中选择一些数据。表中有一列日期时间类型(SQL类型)

存储过程正在使用此

 where CONVERT(varchar(10),post_tarihi,105)=@post_tarihi(event_date)
我有一个方法,它有一个参数,它是字符串类型(Asp.net类型)


当我从sql管理studio执行sp时,返回一些结果 但当我运行asp.net应用程序时,不会返回任何内容。 类型有问题吗

若你们问“为什么要用文本框来表示日期”,我之所以用是因为用了日期选择器(jquery)

我解决了这个问题

1-将SQL参数类型从varchar更改为datetime,并将查询更改为

CONVERT(date,post_tarihi)= @post_tarihi
2-将Asp.net参数类型从字符串更改为datetime

 <asp:ControlParameter  ControlID="txtDate" Name="post_tarihi" DefaultValue="2013-11-13"  PropertyName="Text" Type="DateTime"/>


3-将日期时间格式“DD-MM-YYYY”更改为“YYYY-MM-DD”

我认为,在这种情况下,当您通过asp.net传递参数时,它会转换为空日期,这就是为什么您的r没有得到任何结果日期选择器使用的日期格式是什么?需要是MM-DD-YYYY才能匹配105的格式代码。@BWS-format=“DD-MM-YYYY”。但这不是问题。因为正如您所看到的,我正在将datetime列转换为“DD-MM-YYYY”,我不认为格式有问题。因为参数(13-11-2013)@BhaveshKachhadiya的默认值返回空,所以我选中了asp.net debug.sending参数为“13-11-2013”。asp.net方面似乎有问题
 <asp:ControlParameter  ControlID="txtDate" Name="post_tarihi" DefaultValue="2013-11-13"  PropertyName="Text" Type="DateTime"/>