我的 sql 语句如下 insert 语句仅有效 update 和 delete 语句无效
Purchase_InvoiceNo 是 Purchase 表的主键列我像这样得到这个值并将其值插入到 PurchaseProduct 表“SELECT IDENT_CURRENT ('Purchase') AS [Purchase_InvoiceNo]”
string deletecmd_PurchaseProduct =
@"DELETE FROM PurchaseProduct " +
"PurchaseProduct_No=@PurchaseProduct_No and "+
"Purchase_InvoiceNo=@Purchase_InvoiceNo ";
string updatcmd_PurchaseProduct =
"UPDATE PurchaseProduct "
+ " SET "
+ " PurchaseProduct_SerialNo =@PurchaseProduct_SerialNo"
+ ", Purchase_InvoiceNo =@Purchase_InvoiceNo"
+ ", ProductNo =@ProductNo"
+ " PurchaseProduct_Quantity =@PurchaseProduct_Quantity "
+ ", PurchaseProduct_Unit =@PurchaseProduct_Unit"
+ ", PurchaseProduct_Price =@PurchaseProduct_Price"
+ " Where "
+ " PurchaseProduct_No=@PurchaseProduct_No";
string insertcmd_PurchaseProduct = "INSERT INTO PurchaseProduct" +
"(" +
" PurchaseProduct_SerialNo"+
",Purchase_InvoiceNo" +
",ProductNo" +
",PurchaseProduct_Quantity " +
",PurchaseProduct_Price" +
",PurchaseProduct_Unit" + //6
")" +
"Values" +
"(" +
" @PurchaseProduct_SerialNo"+
",@Purchase_InvoiceNo" +
",@ProductNo " +
",@PurchaseProduct_Quantity " +
",@PurchaseProduct_Price" +
",@PurchaseProduct_Unit" + //6
");";