这有什么问题吗? : [英] What is wrong with this please? :
问题描述
我看了这个,只是不知道为什么错误是未处理的
类型''System.Runtime.InteropServices.COMException''
发生在db2sql.exe中
附加信息:无法将值NULL插入列
''CitatedDateTime'',表''tsNess .dbo.tblTravelDetail '';列没有
允许空值。 INSERT失败。
除了@@身份之外,这个语法与我工作的其他
程序完全相同:
对象记录受影响;
string strSQL2 =" INSERT INTO tblTravelDetail(MemberID)" +
" VALUES(''" + TxtMLV.Text.Trim()+"'')" +
" SELECT @@ IDENTITY" ;
cnn2.Execute(strSQL2,out recordsEffected,0);
谢谢,
Trint
I''ve looked this over and just don''t get why the error is "An unhandled
exception of type ''System.Runtime.InteropServices.COMException''
occurred in db2sql.exe
Additional information: Cannot insert the value NULL into column
''CreatedDateTime'', table ''tsNess.dbo.tblTravelDetail''; column does not
allow nulls. INSERT fails."
This syntax, except for the @@identity, is exactly the same in my other
programs that work:
Object recordsEffected;
string strSQL2 = "INSERT INTO tblTravelDetail(MemberID) " +
"VALUES (''" + TxtMLV.Text.Trim() + "'')" +
"SELECT @@IDENTITY " ;
cnn2.Execute(strSQL2, out recordsEffected, 0);
Thanks,
Trint
推荐答案
看起来你有一个必填字段,那个表没有填充。
詹姆斯
" trint" < TR *********** @ gmail.com>在消息中写道
news:11 ********************** @ o13g2000cwo.googlegr oups.com ...
It looks like you have a required field for that table that hasn''t been
populated.
James
"trint" <tr***********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
我已经看了这个,只是不知道为什么错误是未处理的
类型''System.Runtime.InteropServices.COMException''
发生在db2sql.exe
附加信息:无法将值NULL插入列
''CreatedDateTime'',表''tsNess.dbo.tblTravelDetail'';列不允许空值。 INSERT失败。
除了@@ identity之外,这个语法在我的其他工作程序中完全相同:
对象记录受影响;
string strSQL2 =" INSERT INTO tblTravelDetail(MemberID)" +
" VALUES(''" + TxtMLV.Text.Trim()+"'')" +
SELECT @@ IDENTITY ;
cnn2.Execute(strSQL2,out recordsEffected,0);
谢谢,
Trint
I''ve looked this over and just don''t get why the error is "An unhandled
exception of type ''System.Runtime.InteropServices.COMException''
occurred in db2sql.exe
Additional information: Cannot insert the value NULL into column
''CreatedDateTime'', table ''tsNess.dbo.tblTravelDetail''; column does not
allow nulls. INSERT fails."
This syntax, except for the @@identity, is exactly the same in my other
programs that work:
Object recordsEffected;
string strSQL2 = "INSERT INTO tblTravelDetail(MemberID) " +
"VALUES (''" + TxtMLV.Text.Trim() + "'')" +
"SELECT @@IDENTITY " ;
cnn2.Execute(strSQL2, out recordsEffected, 0);
Thanks,
Trint
好的,
这次我包含了createddatetime字段,错误继续发生在
另一个字段:
不能将值NULL插入列''TravelEventId'',表格
''tsNess.dbo.tblTravelDetail'';列不允许空值。 INSERT
失败。
谢谢,
Trint
..Net程序员
tr***********@gmail.com >
***通过开发人员指南 http://www.developersdex.com发送 ***
Ok,
I included the createddatetime field this time and the error went on to
another field:
"Cannot insert the value NULL into column ''TravelEventId'', table
''tsNess.dbo.tblTravelDetail''; column does not allow nulls. INSERT
fails."
Thanks,
Trint
..Net programmer
tr***********@gmail.com
*** Sent via Developersdex http://www.developersdex.com ***
您需要为不支持NULL值的所有列赋值
查看表格定义,你会知道哪些字段是
那些。
啦啦队,
-
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
佛罗里达州交通局
" trint" < TR *********** @ gmail.com>在消息中写道
news:11 ********************** @ o13g2000cwo.googlegr oups.com ...
You need to give values to ALL columns that do not support NULL values
take a look at the table definition and you will know which fields are
those.
cheerrs,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"trint" <tr***********@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
我已经看了这个,只是不知道为什么错误是未处理的
类型''System.Runtime.InteropServices.COMException''
发生在db2sql.exe
附加信息:无法将值NULL插入列
''CreatedDateTime'',表''tsNess.dbo.tblTravelDetail'';列不允许空值。 INSERT失败。
除了@@ identity之外,这个语法在我的其他工作程序中完全相同:
对象记录受影响;
string strSQL2 =" INSERT INTO tblTravelDetail(MemberID)" +
" VALUES(''" + TxtMLV.Text.Trim()+"'')" +
SELECT @@ IDENTITY ;
cnn2.Execute(strSQL2,out recordsEffected,0);
谢谢,
Trint
I''ve looked this over and just don''t get why the error is "An unhandled
exception of type ''System.Runtime.InteropServices.COMException''
occurred in db2sql.exe
Additional information: Cannot insert the value NULL into column
''CreatedDateTime'', table ''tsNess.dbo.tblTravelDetail''; column does not
allow nulls. INSERT fails."
This syntax, except for the @@identity, is exactly the same in my other
programs that work:
Object recordsEffected;
string strSQL2 = "INSERT INTO tblTravelDetail(MemberID) " +
"VALUES (''" + TxtMLV.Text.Trim() + "'')" +
"SELECT @@IDENTITY " ;
cnn2.Execute(strSQL2, out recordsEffected, 0);
Thanks,
Trint
这篇关于这有什么问题吗? :的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!