在一个命令中组合2个插入

时间:2016-04-28 22:37:37

标签: insert-into

我无法弄清楚这一点: 我想在表格中添加一行-a,此行的3列将来自表格-b,其他2列将来自例如文本框... 这段代码不起作用......

describe('Component: video', function () {

  beforeEach(module('video'));
  .......
  .......

1 个答案:

答案 0 :(得分:0)

只需将参数作为静态值放在select语句中。

SqlCommand cmd35 = new SqlCommand("INSERT INTO BTmr (Barcode,[Machine Name],
    [Machine ID],[Repair Cost],[Repair Date]) SELECT Barcode,[Machine Name],
    [Machine ID],@cst AS [Repair Cost],@rprd AS [Repair Date] FROM BkmP WHERE
    barcode like '" + c13 + "%', connection);

cmd35.Parameters.AddWithValue("@cst", textBox10.Text);
cmd35.Parameters.AddWithValue("@rprd", dateTimePicker1.Text);

当你在它时,参数化where子句:https://stackoverflow.com/a/251380/123422