应该在何时使用Parameters.Add/AddWithValue
? 在以下MSDN示例中,他们使用Parameters.Add
添加int
,使用Parameters.AddWithValue
添加string
。
command.Parameters.Add("@ID", SqlDbType.Int);
command.Parameters["@ID"].Value = customerID;
command.Parameters.AddWithValue("@demographics", demoXml);
什么是在 datetime
中最好使用的内容?
cmd.Parameters.Add
现在已经被弃用。请改用cmd.Parameters.AddWithValue
。 - Rahul Nikate