更新时间:2023-01-22 17:15:03
尝试一下
方法1:
Try this
Method1:
SqlCommand command = new SqlCommand("insert into TableName values
(@Col1,@Col2)",connection);
command.Parameters.AddWithValue("@Col2",DBNull.Value);
方法2:
Method2:
SqlCommand command = new SqlCommand("insert into TableName values
(@Col1,@Col2)",connection);
command.Parameters.Add("@Col2",System.Data.SqlDbType.Int).Value=DBNull.Value;
以下是一些方法: ^ ]
Here are some methods: http://***.com/questions/4555935/how-to-assign-null-to-a-sqlparameter[^]