DateTime Stamp默认值不起作用 [英] DateTime Stamp default value is just not working

查看:112
本文介绍了DateTime Stamp默认值不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用spqdatasource控件将一些数据输入到简单表中,但是由于某种原因,它不会将日期时间添加到相关列中

Webform源看起来像这样...

 <   InsertParameters  > ; 
            <   asp:ControlParameter    名称  ="  类型  字符串"  ControlID    txtDiary" / <   asp:Parameter    名称  ="  类型   DateTime " / <  /InsertParameters  >   




我的表datetimestamp列正在使用默认值(getdate())

DiaryEntry可以毫无问题地保存,但是日期仍保存为null

解决方案

尝试在数据访问层而不是UI层插入getdate(). /blockquote>

修复了该问题...

弄清楚我在日期的insert参数中将其传递为null.删除了insert参数,默认情况下会立即插入时间


Im using a spqdatasource control to enter some data into a simple table but for some reason it just will not add the datetime to the relevant column

webform source looks like this...

<InsertParameters>
            <asp:ControlParameter Name="DiaryEntry" Type="String" ControlID="txtDiary" />
            <asp:Parameter Name="DateStamp" Type="DateTime" />
        </InsertParameters>




my table datetimestamp column is using the default value (getdate())

the DiaryEntry is saving with no problems at all, but the date keeps saving as null

解决方案

try to insert getdate() at data access layer instead of UI layer.


fixed it...

Figured out I was passing it null in the insert parameter for the date. removed the insert parameter and it inserts time by default now


这篇关于DateTime Stamp默认值不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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