没有什么不相容的

编程入门 行业动态 更新时间:2024-10-14 00:30:14
本文介绍了没有什么不相容的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

VS 2003,vb,sql native(MSDE)... 我反对Nothing关键词的不一致。 文档说明将为任何数据类型分配一个默认值......好吧, 不完全正确。这里有两个例子: 示例1)dim x as string = nothing,x的值是什么(而不是 string.empty)。向SQL添加行时,值为X 的列将在不允许空值的表中失败,因为Nothing已翻译为到DBNull。那么,字符串的默认值是DBNull?这不是很直接。 示例2)dim y as Boolean = nothing,x的值为false(这使得 感觉)。这写入SQL表格为0(false) 但是,请考虑布尔列数据类型,DataColumn.defaultvalue = 没有。向SQL添加行时,值为 ..defaultvalue = nothing的布尔列将在不允许空值的表中失败 因为没有翻译到DBNull(而不是false)。那么,一个布尔值的 ..defaultvalue是DBNull吗?这不是很直观。 以上每次都可以复制。 这些关于Nothing的文档的不一致令人沮丧 且耗时。在未来的版本中,有人应该花时间制作Nothing - 我们将不胜感激。 Bob Day

VS 2003, vb, sql native (MSDE)... I have railed against the inconsistency of the Nothing key word. The documentation says is will assign a default value for any datatype...well, not exactly. Here are 2 more examples: Example 1) dim x as string = nothing, the value of x is nothing (instead of string.empty). When you add a row to SQL, the column with the value of X will fail in a table that does not allow nulls because Nothing is translated to DBNull. So, the default value of a string is DBNull? That is not very intuitive. Example 2) dim y as Boolean = nothing, the value of x is false (which makes sense). This writes to an SQL table fine as 0 (false) However, consider a Boolean column datatype, DataColumn.defaultvalue = nothing. When you add a row to SQL, the Boolean column with the value of ..defaultvalue = nothing will fail in a table that does not allow nulls because Nothing is translated to DBNull (instead of false). So, the ..defaultvalue of a Boolean is DBNull? That is not very intuitive. The above are replicatable every time. These inconsistencies with the documentation about Nothing are frustrating and time consuming. Someone should spend the time to make Nothing consistent in a future release - it would be appreciated. Bob Day

推荐答案

我不知道我是否会说它不是直观的事实上,我认为非常好。 空字符串和空值之间存在重大差异。理解Nothing和空值之间的区别。 没有什么说它不存在,Empty说它存在但没有价值。请参阅 的区别? 此外,还有更多的应用程序不使用DB',其中一个空的 与Null不同。预测在语言中将是不可能的。所以选择给程序员。 希望它有所帮助。我知道它没有意义,但它真正理解 对象是什么与价值相比。 -CJ Bob Day <博**** @ TouchTalk>在消息中写道 news:%2 **************** @ TK2MSFTNGP09.phx.gbl ... I don''t know if I would say its not "intuitive" in fact, I think it very much is. There is a major difference between an empty string and a null value. As well as understanding the difference between Nothing and and empty value. Nothing says it doesn''t exist, Empty says it exists but with no value. See the difference? Also, there are many more applications that don''t use DB''s, where an Empty is different from a Null. To predict that within the language would be impossible. So the option is given to the programmer. Hope it helps. I know it doesn''t make sense, but its really understanding what an object is vs. a value. -CJ "Bob Day" <Bo****@TouchTalk> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl... VS 2003 ,vb,sql native(MSDE)... 我反对Nothing关键词的不一致。 文档说明将为任何数据类型分配一个默认值......好吧,不完全是。这里有两个例子: 示例1)dim x as string = nothing,x的值是什么(而不是 of string.empty)。向SQL添加行时,值为X 的列将在不允许空值的表中失败,因为Nothing是转换为DBNull。那么,字符串的默认值是DBNull?这不是很直观。 示例2)dim y as Boolean = nothing,x的值为false(有意义)。这写入SQL表格为0(错误) 然而,考虑一个布尔列数据类型,DataColumn.defaultvalue = 没有。向SQL添加行时,值为 .defaultvalue = nothing的布尔列将在不允许空值的表中失败因为Nothing未转换为DBNull(而不是false)。那么,布尔值的 .defaultvalue是DBNull吗?这不是很直观。 以上每次都可复制。 这些与Nothing文档的不一致是令人沮丧的,而且耗费时间。在未来的版本中,有人应该花时间让Nothing 保持一致 - 我们将不胜感激。 Bob Day VS 2003, vb, sql native (MSDE)... I have railed against the inconsistency of the Nothing key word. The documentation says is will assign a default value for any datatype...well, not exactly. Here are 2 more examples: Example 1) dim x as string = nothing, the value of x is nothing (instead of string.empty). When you add a row to SQL, the column with the value of X will fail in a table that does not allow nulls because Nothing is translated to DBNull. So, the default value of a string is DBNull? That is not very intuitive. Example 2) dim y as Boolean = nothing, the value of x is false (which makes sense). This writes to an SQL table fine as 0 (false) However, consider a Boolean column datatype, DataColumn.defaultvalue = nothing. When you add a row to SQL, the Boolean column with the value of .defaultvalue = nothing will fail in a table that does not allow nulls because Nothing is translated to DBNull (instead of false). So, the .defaultvalue of a Boolean is DBNull? That is not very intuitive. The above are replicatable every time. These inconsistencies with the documentation about Nothing are frustrating and time consuming. Someone should spend the time to make Nothing consistent in a future release - it would be appreciated. Bob Day

Bob, 你试过吗? 如果Nothing = String.Empty那么 MessageBox。显示(空) 结束如果 我不会说完全直接清楚Nothing但对我来说,SQL语法中的后续问题更加严重。 Cor Bob, Did you try this? If Nothing = String.Empty Then MessageBox.Show("empty") End If I would not say it is all direct clear with "Nothing" but for me the inconsequenties in the SQL syntax are worser. Cor

" Cor" < no*@non>在消息中写道 news:3f *********************** @ reader21.wxs.nl ... "Cor" <no*@non> wrote in message news:3f***********************@reader21.wxs.nl... 鲍勃, 你有没试过?如果Nothing = String.Empty那么 MessageBox.Show(" empty")结束如果 我不会说完全直接明确的是没什么。但对我来说,SQL语法中的后续问题更加严重。 更糟糕????????? 是否有适当的战略? Cor Bob, Did you try this? If Nothing = String.Empty Then MessageBox.Show("empty") End If I would not say it is all direct clear with "Nothing" but for me the inconsequenties in the SQL syntax are worser. worser????????? is that like having the proper strategery? Cor

更多推荐

没有什么不相容的

本文发布于:2023-11-17 02:42:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1608510.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:没有什么   不相容

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!