如何向数据库发送NULL? [英] how to send NULL to database?

查看:71
本文介绍了如何向数据库发送NULL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hy,我在我的表中有int列''number'',当我在winform应用程序中实例化dataTable时,允许空值


。我想做

table.AddTableRow(字符串名称,整数);

我需要将''number''的空值发送到我的表。我不知道怎么样......

我试过Nullable< intand else ..没用。

使用sql 2005 express


请帮助!

谢谢。

-

如果是7?11一年365天,每天24小时开放,为什么门上有锁?


?Nick Featherman

hy, I have int column ''number'' in my table that allowes nulls

when I instance a dataTable in my winform app. and I want to do
table.AddTableRow(string name, int number);
I need to send null value for ''number'' to my table. I don''t know how..
I tried with Nullable<intand else .. didn''t work.
using sql 2005 express

please help!
thanks.
--
If a "7?11" is open 24 hours a day, 365 days a year, why are there locks on
the door?

?Nick Featherman

推荐答案



" Bllich" < bl ******** @ DELETEyahoo.com写信息

新闻:Xn ********************** @ 195.29.150.88 ...

"Bllich" <bl********@DELETEyahoo.comwrote in message
news:Xn**********************@195.29.150.88...

hy,我在我的表中有int列''number''允许空值

$ b当我在winform应用程序中实例化dataTable时$ b。我想做

table.AddTableRow(字符串名称,整数);

我需要将''number''的空值发送到我的表。我不知道怎么样......

我试过Nullable< intand else ..没用。

使用sql 2005 express


请帮忙!

谢谢。


-

如果是7-11一年365天,每天24小时开放,为什么门上有锁?


hy, I have int column ''number'' in my table that allowes nulls

when I instance a dataTable in my winform app. and I want to do
table.AddTableRow(string name, int number);
I need to send null value for ''number'' to my table. I don''t know how..
I tried with Nullable<intand else .. didn''t work.
using sql 2005 express

please help!
thanks.
--
If a "7-11" is open 24 hours a day, 365 days a year, why are there locks
on
the door?



当他们建造这个地方时,工人们不希望他们的工具被盗b
。对于你的其他问题,请使用DBNull.Value

When they were building the place the workmen didn''t want their tools
stolen. For your other question use DBNull.Value


-Nick Featherman
-Nick Featherman



" PS" < ec *********** @ hotmail.comwrote in news:Uo4Ih.6143
"PS" <ec***********@hotmail.comwrote in news:Uo4Ih.6143


pi.2015@trndny09:
pi.2015@trndny09:

当他们建造这个地方时,工人们不希望他们的工具被盗b
。对于你的其他问题,请使用DBNull.Value
When they were building the place the workmen didn''t want their tools
stolen. For your other question use DBNull.Value



;)


如果它是字符串类型列,那将很容易但这是int类型

所以我仍然得到一个错误 - 无法从''System.DBNull''转换为''int''。

;)

it would be easy if it was a string type column, but this is int type
so I still get an Error - cannot convert from ''System.DBNull'' to ''int''.


这篇关于如何向数据库发送NULL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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