本文介绍了我认为,当SqlParameter.IsNullable才有意义......?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1) SqlParameter.IsNullable 设置为真正,获得值转换为 DBNull.Value 并发送至数据库。因此,我将承担制定 ISNULLABLE 真正才有意义,当GridView的 Parameter.ConvertEmptyStringToNull 也被设置为真正

1) When SqlParameter.IsNullable is set to true, received null value is converted to DBNull.Value and sent to database. Thus I would assume setting IsNullable to true only makes sense when GridView’s Parameter.ConvertEmptyStringToNull is also set to true?

2)两个GridView的和ObjectDataSource的参数有一个 ConvertEmptyStringToNull 属性。但有过的情况下(试图更新数据源时):

2) Both GridView’s and ObjectDataSource’s parameters have a ConvertEmptyStringToNull property. But is there ever a situation where ( when trying to update data source ):

•我们应该设置GridView的 Parameter.ConvertEmptyStringToNull 真正,但然后设置ObjectDataSource的 Parameter.ConvertEmptyStringToNull

• where we should set GridView’s Parameter.ConvertEmptyStringToNull to true, but then set ObjectDataSource’s Parameter.ConvertEmptyStringToNull to false?!

•或者我们应该设置GridView的 Parameter.ConvertEmptyStringToNull 真正,但SqlDataSource控件的 SqlParameter.IsNullable

• or where we should set GridView’s Parameter.ConvertEmptyStringToNull to true, but SqlDataSource’s SqlParameter.IsNullable to false?

推荐答案

在一般的反应是NO你所有的问题,因为并非总是有一个DataGrid,这是不显示数据或获取的唯一途径来自用户的输入。

The responses in general are "NO" to all your questions, because not always there is a DataGrid, which is not the only way to show data and or get an input from the user.

如果您的用户界面提供数据以另一种方式(如的DetailView,FromView,手工制作的窗口,或页等),或者你还没有在所有的用户界面,你的数据来自其他来源,你可能要应对 ISNULLABLE 和/或 ConvertEmptyStringToNull 从一个不存在的一个DataGrid的属性独立!

If your user interface provides data in another way (e.g. DetailView, FromView, hand-made-window-or-page, etc...), or you have not UI at all, and your data come from another source, you may have to deal with IsNullable and/or ConvertEmptyStringToNull properties independently from a DataGrid that does not exists!

ISNULLABLE 尤其是,当你调用存储过程,应该匹配参数的SP的定义。

IsNullable in particular, when you are calling stored procedures, should match the sp's definition of the parameter.

这篇关于我认为,当SqlParameter.IsNullable才有意义......?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 04:05