继续到vb.net中的下一行的SQL语句错误

时间:2013-11-10 14:28:16

标签: sql vb.net winforms

这是我要继续下一行的SQL语句,但它在value子句中显示错误,我实际上想将语句分成多行

sqlstr = "insert into       pos_invoice_hdr(invoice_no, loc_code, invoce_type, invoice_date, cust_code, gross_amt, disc_percent, net_amt, doctor_code, loose_qty, pkt_qty, remarks, ccy, card_no, card_type, invoice_by) _"
    "values("@invoice_no, @loc_code, @invoice_type, @invoice_Date, @cust_code, @gross_amt, @disc_percent, @net")"

2 个答案:

答案 0 :(得分:0)

您的陈述输入参数少于表格预期。

16个字段......

(invoice_no, 
 loc_code, 
 invoce_type, 
 invoice_date, 
 cust_code, 
 gross_amt, 
 disc_percent, 
 net_amt, 
 doctor_code, 
 loose_qty, 
 pkt_qty, 
 remarks, 
 ccy, 
 card_no, 
 card_type, 
 invoice_by) _"
values

8个值...

("@invoice_no, 
@loc_code, 
@invoice_type,
@invoice_Date, 
@cust_code, 
@gross_amt,
@disc_percent,
@net")"

您需要删除以下字段..

doctor_code, 
     loose_qty, 
     pkt_qty, 
     remarks, 
     ccy, 
     card_no, 
     card_type, 
     invoice_by

或添加更多值。

答案 1 :(得分:0)

你试过这样的事吗?

sqlstr = "insert into pos_invoice_hdr(invoice_no, loc_code, invoce_type,   invoice_date, cust_code, gross_amt, disc_percent, net_amt, doctor_code, loose_qty, pkt_qty,  remarks, ccy, card_no, card_type, invoice_by)" & _
     "values(@invoice_no, @loc_code, @invoice_type, @invoice_Date, @cust_code,   @gross_amt, @disc_percent, @net)"

类似

 Dim str as string 
       str = "first string" & _
           "second string"