|
|
|
พี่ครับ incorrect syntax near 'Varchar' มันคืออะไรหรอครับ ไม่เข้าใจ |
|
|
|
|
|
|
|
Code (VB.NET)
Private Sub btn_ADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ADD.Click
'If txtID.Text = "" Or txtConfig.Text = "" Or txtModel.Text = "" Or txtGS.Text = "" Or txtSTS.Text = "" Or txtSName.Text = "" Or txt1D_GC.Text = "" Or txt1D_RDB.Text = "" Or txt1D_C.Text = "" Or txtCon.Text = "" Or txtPC.Text = "" Or txtPN.Text = "" Or txtACA.Text = "" Or txtFC.Text = "" Or txtPSA.Text = "" Or txtGK.Text = "" Or txtBK.Text = "" Or txtBR.Text = "" Or txtSB.Text = "" Or _
' txtAD.Text = "" Or txtCC.Text = "" Or txtDPPCA.Text = "" Or txtDIGI5.Text = "" Or txtDIGI10.Text = "" Or txtCR.Text = "" Or txtCode_C.Text = "" Then
'End If
sb = New StringBuilder
sb.Append("INSERT INTO tblchkconfig(id_config ,Config_Name ,ModelGroup ,GroupScan ,sts ,sname ,[1D_GroupCode] ,[1D_Readable] ,[1D_Color] ,Config ,Pcca ,PartNo ,ACA ,FlexClamp ,PSA ,Gasket ,Bracket ,Bearing ,Snubber ,Adhesive ,CodeColor ,Digit5_PCCA ,digi5 ,digi10 ,Code_Readable ,Code_Config ,Tray_Readable ,Digi5Forbid ,Pcca_VendorCode ,PreAmp_DateCode ,PreAmp_DateCode_Forbidden ,PreAmp_Rev ,PreAmp_Rev_Forbidden ,pfile ,label ,[2D_File] ,[2D_Label] ,Chk2D ,[2DSetChk] ,ChkSticker ,ChkTray ,tray_10k ,DummyTray ,len_mapping ,len_mapping_c100 ,Pack_Qty ,Pallet_Qty ,do_qty ,ptfile ,ptlabel ,ptqty ,prtLotSize ,Timeout_Scan ,Timeout_C10K ,Timeout_C100 ,BarcodeExpired ,LaserMic ,ChkBearing ,Lot_size ,Sampling ,comment ,ChkBearingBonding)")
sb.Append(" VALUES (@id_config ,@Config_Name ,@ModelGroup ,@GroupScan ,@sts ,@sname ,@[1D_GroupCode] ,@[1D_Readable] ,@[1D_Color] ,@Config ,@Pcca ,@PartNo ,@ACA ,@FlexClamp ,@PSA ,@Gasket ,@Bracket ,@Bearing ,@Snubber ,@Adhesive ,@CodeColor ,@Digit5_PCCA ,@digi5 ,@digi10 ,@Code_Readable ,@Code_Config ,@Tray_Readable ,@Digi5Forbid ,@Pcca_VendorCode ,@PreAmp_DateCode ,@PreAmp_DateCode_Forbidden ,@PreAmp_Rev ,@PreAmp_Rev_Forbidden ,@pfile ,@label ,@[2D_File] ,@[2D_Label] ,@Chk2D ,@[2DSetChk] ,@ChkSticker ,@ChkTray ,@tray_10k ,@DummyTray ,@len_mapping ,@len_mapping_c100 ,@Pack_Qty ,@Pallet_Qty ,@do_qty ,@ptfile ,@ptlabel ,@ptqty ,@prtLotSize ,@Timeout_Scan ,@Timeout_C10K ,@Timeout_C100 ,@BarcodeExpired ,@LaserMic ,@ChkBearing ,@Lot_size ,@Sampling ,@comment ,@ChkBearingBonding)")
Dim sqlAdd As String
sqlAdd = sb.ToString()
exeCommend = New SqlCommand()
Try
With exeCommend
.CommandText = sqlAdd
.Connection = conn
conn.Open()
'GenerateID()
.Parameters.Add("@id_config", SqlDbType.SmallInt).Value = txtID.Text.Trim
.Parameters.Add("@Config_Name", SqlDbType.NVarChar).Value = txtConfig.Text.Trim
.Parameters.Add("@ModelGroup", SqlDbType.Char).Value = txtModel.Text.Trim
.Parameters.Add("@GroupScan", SqlDbType.VarChar).Value = txtGS.Text.Trim
.Parameters.Add("@sts", SqlDbType.Char).Value = txtSTS.Text.Trim
.Parameters.Add("@sname", SqlDbType.VarChar).Value = txtSName.Text.Trim
.Parameters.Add("@[1D_GroupCode]", SqlDbType.VarChar).Value = txt1D_GC.Text.Trim
.Parameters.Add("@[1D_Readable]", SqlDbType.VarChar).Value = txt1D_RDB.Text.Trim
.Parameters.Add("@[1D_Color]", SqlDbType.VarChar).Value = txt1D_C.Text.Trim
.Parameters.Add("@Config", SqlDbType.VarChar).Value = txtCon.Text.Trim
.Parameters.Add("@Pcca", SqlDbType.VarChar).Value = txtPC.Text.Trim
.Parameters.Add("@PartNo", SqlDbType.VarChar).Value = txtPN.Text.Trim
.Parameters.Add("@ACA", SqlDbType.VarChar).Value = txtACA.Text.Trim
.Parameters.Add("@FlexClamp", SqlDbType.VarChar).Value = txtFC.Text.Trim
.Parameters.Add("@PSA", SqlDbType.VarChar).Value = txtPSA.Text.Trim
.Parameters.Add("@Gasket", SqlDbType.VarChar).Value = txtGK.Text.Trim
.Parameters.Add("@Bracket", SqlDbType.VarChar).Value = txtBK.Text.Trim
.Parameters.Add("@Bearing", SqlDbType.VarChar).Value = txtBR.Text.Trim
.Parameters.Add("@Snubber", SqlDbType.VarChar).Value = txtSB.Text.Trim
.Parameters.Add("@Adhesive", SqlDbType.VarChar).Value = txtAD.Text.Trim
.Parameters.Add("@CodeColor", SqlDbType.VarChar).Value = txtCC.Text.Trim
.Parameters.Add("@Digit5_PCCA", SqlDbType.Char).Value = txtDPPCA.Text.Trim
.Parameters.Add("@digi5", SqlDbType.Char).Value = txtDIGI5.Text.Trim
.Parameters.Add("@digi10", SqlDbType.Char).Value = txtDIGI10.Text.Trim
.Parameters.Add("@Code_Readable", SqlDbType.VarChar).Value = txtCR.Text.Trim
.Parameters.Add("@Code_Config", SqlDbType.VarChar).Value = txtCode_C.Text.Trim
.Parameters.Add("@Tray_Readable", SqlDbType.VarChar).Value = txtTR.Text.Trim
.Parameters.Add("@Digi5Forbid", SqlDbType.VarChar).Value = txtDG5F.Text.Trim
.Parameters.Add("@Pcca_VendorCode", SqlDbType.Char).Value = txtPV.Text.Trim
.Parameters.Add("@PreAmp_DateCode", SqlDbType.Char).Value = txtPADC.Text.Trim
.Parameters.Add("@PreAmp_DateCode_Forbidden", SqlDbType.VarChar).Value = txtPDF.Text.Trim
.Parameters.Add("@PreAmp_Rev", SqlDbType.Char).Value = txtPAR.Text.Trim
.Parameters.Add("@PreAmp_Rev_Forbidden", SqlDbType.VarChar).Value = txtPRF.Text.Trim
.Parameters.Add("@pfile", SqlDbType.VarChar).Value = txtPF.Text.Trim
.Parameters.Add("@label", SqlDbType.VarChar).Value = txtLabel.Text.Trim
.Parameters.Add("@[2D_File]", SqlDbType.VarChar).Value = txt2DF.Text.Trim
.Parameters.Add("@[2D_Label]", SqlDbType.VarChar).Value = txt2DLabel.Text.Trim
.Parameters.Add("@Chk2D", SqlDbType.TinyInt).Value = txtC2D.Text.Trim
.Parameters.Add("@[2DSetChk]", SqlDbType.TinyInt).Value = txt2DSetC.Text.Trim
.Parameters.Add("@ChkSticker", SqlDbType.SmallInt).Value = txtCHKS.Text.Trim
.Parameters.Add("@ChkTray", SqlDbType.SmallInt).Value = txtCT.Text.Trim
.Parameters.Add("@tray_10k", SqlDbType.TinyInt).Value = txtT10K.Text.Trim
.Parameters.Add("@DummyTray", SqlDbType.Char).Value = txtDT.Text.Trim
.Parameters.Add("@len_mapping", SqlDbType.TinyInt).Value = txtLM.Text.Trim
.Parameters.Add("@len_mapping_c100", SqlDbType.TinyInt).Value = txtLMC100.Text.Trim
.Parameters.Add("@Pack_Qty", SqlDbType.TinyInt).Value = txtPQ.Text.Trim
.Parameters.Add("@Pallet_Qty", SqlDbType.TinyInt).Value = txtPaQ.Text.Trim
.Parameters.Add("@do_qty", SqlDbType.SmallInt).Value = txtDo_Qty.Text.Trim
.Parameters.Add("@ptfile", SqlDbType.VarChar).Value = txtPTF.Text.Trim
.Parameters.Add("@ptlabel", SqlDbType.VarChar).Value = txtPLabel.Text.Trim
.Parameters.Add("@ptqty", SqlDbType.SmallInt).Value = txtPTQty.Text.Trim
.Parameters.Add("@prtLotSize", SqlDbType.SmallInt).Value = txtPrLS.Text.Trim
.Parameters.Add("@Timeout_Scan", SqlDbType.SmallInt).Value = txtTimeout_S.Text.Trim
.Parameters.Add("@Timeout_C10K", SqlDbType.SmallInt).Value = txtTimeout_C10K.Text.Trim
.Parameters.Add("@Timeout_C100", SqlDbType.SmallInt).Value = txtTimeout_C100.Text.Trim
.Parameters.Add("@BarcodeExpired", SqlDbType.SmallInt).Value = txtBCE.Text.Trim
.Parameters.Add("@LaserMic", SqlDbType.TinyInt).Value = txtLaM.Text.Trim
.Parameters.Add("@ChkBearing", SqlDbType.TinyInt).Value = txtChkB.Text.Trim
.Parameters.Add("@Lot_size", SqlDbType.TinyInt).Value = txtLS.Text.Trim
.Parameters.Add("@Sampling", SqlDbType.SmallInt).Value = txtSl.Text.Trim
.Parameters.Add("@comment", SqlDbType.NVarChar).Value = txtCom.Text.Trim
.Parameters.Add("@ChkBearingBonding", SqlDbType.TinyInt).Value = txtChkBB.Text.Trim
.ExecuteNonQuery()
End With
MessageBox.Show("เพิ่มข้อมูลลงฐานข้อมูลเรียบร้อยแล้ว", "ผลการมำงาน", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As SqlException
MessageBox.Show("เกิดข้อผิดพลาด กรุณาตรวจสอบ" & ex.Message.ToString, "ผลการทำงาน", MessageBoxButtons.OK, MessageBoxIcon.Warning)
'MessageBox.Show("เกิดข้อผิดพลาด กรุณาตรวจสอบ", "ผลการทำงาน", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End Try
End Sub
Tag : .NET, VB.NET
|
ประวัติการแก้ไข 2013-08-08 15:16:03
|
|
|
|
|
Date :
2013-08-08 14:19:31 |
By :
Bill17259 |
View :
1200 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใช่ครับ Varchar ครับ
|
|
|
|
|
Date :
2013-08-08 15:13:02 |
By :
Bill17259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|