最近用C#编一个SQL存储的程序,遇到一个问题,就是新添加的记录有时候不是在表的最后添加,而是突然在表中间的部分添加,我不知道是我C#代码问题,还是SQL语句有问题,麻烦请大家指教下,谢谢。connection.Open();
SqlCommand mycommand = new SqlCommand("insert into OrderList(ID,OrderName,Property1,Property2,Property3,NextOrder,Property4,Property5) values(newID(),0,null,null,null,'00000000-0000-0000-0000-000000000000',null,null)", connection);
mycommand.ExecuteNonQuery();
connection.Close();
ID是uniqueidentifier
OrderName是Int
Property1是String,可为NULL
Property2是String,可为NULL
Property3是String,可为NULL
NextOrder是uniqueidentifier,可为NULL
Property4是String,可为NULL
Property5是String,可为NULL
SqlCommand mycommand = new SqlCommand("insert into OrderList(ID,OrderName,Property1,Property2,Property3,NextOrder,Property4,Property5) values(newID(),0,null,null,null,'00000000-0000-0000-0000-000000000000',null,null)", connection);
mycommand.ExecuteNonQuery();
connection.Close();
ID是uniqueidentifier
OrderName是Int
Property1是String,可为NULL
Property2是String,可为NULL
Property3是String,可为NULL
NextOrder是uniqueidentifier,可为NULL
Property4是String,可为NULL
Property5是String,可为NULL
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货