什么错了? submit.CommandText = sql?

时间:2013-03-29 04:26:09

标签: compiler-errors

Dim sql As String

sql = "insert into transactions (`transid`) values('" + Text1.Text + "')"
sql = sql & "; insert into customer (`custid`) values('" + Text2.Text + "')"
sql = sql & "; insert into customer (`custname`) values('" + Text3.Text + "')"
sql = sql & "; insert into transactions (`custid`) values('" + Text2.Text + "')"
sql = sql & "; insert into transactions (`serviceid`) values('" + Combo1.Text + "')"
sql = sql & "; insert into transactions (`empid`) values('" + Combo2.Text + "')"
 submit.CommandText = sql

我应该在submit.CommandText = sql中放什么,我无法理解这一部分。请帮帮我们。 :)

1 个答案:

答案 0 :(得分:0)

看起来您可以将其简化为:

sql = "insert into transactions(transid, custid, serviceid, empid) _
 values('" + Text1.Text + "','" + Text2.Text + "', '" + Combo1.Text + "', '" + Combo2.Text "');"
sql = sql + " insert into customer(custid, custname) values('" + Text2.Text + "', '" + Text3.Text + "');"