在insert 操作过程中报错问题
Dim mycon As SqlConnection = New SqlConnection(con)
mycon.Open()
Dim mycom As SqlCommand = New SqlCommand("insert into bookin(customname,customID,roomno,indate,discount,inmemo) values ('" + Trim(Me.T_Dgkname.Text) + "','" + Trim(Me.T_Dgkid.Text) + "','" + Trim(Me.C_Dkfbh.SelectedItem) + "','" + Trim(Me.T_Dtime.Text) + "'," + Trim(Me.T_Dzk.Text) + ",'" + Trim(Me.T_Dbzxx.Text) + "')", mycon)
Dim myupdata As Integer = mycom.ExecuteNonQuery
mycon.Close()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
运行到"Dim myupdata As Integer = mycom.ExecuteNonQuery"行总是报错。
但把
insert into bookin(customname,customID,roomno,indate,discount,inmemo) values ('" + Trim(Me.T_Dgkname.Text) + "','" + Trim(Me.T_Dgkid.Text) + "','" + Trim(Me.C_Dkfbh.SelectedItem) + "','" + Trim(Me.T_Dtime.Text) + "'," + Trim(Me.T_Dzk.Text) + ",'" + Trim(Me.T_Dbzxx.Text) + "')
单独放在sql查询器内运行又很正常,这是为什么啊?