I assume SqlParameter.IsNullable only makes sense when…?
Asked Answered
B

2

2

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) Both GridView’s and ObjectDataSource’s parameters have a ConvertEmptyStringToNull property. But is there ever a situation where ( when trying to update data source ):

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

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

Brechtel answered 2/6, 2009 at 21:3 Comment(0)
D
0

Ans : 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? - simply yes

Diazotize answered 29/1, 2011 at 20:24 Comment(0)
P
0

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.

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 in particular, when you are calling stored procedures, should match the sp's definition of the parameter.

Popery answered 22/2, 2011 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.