首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我一直在“emppic”vb.net附近出现这个错误“无效语法”

我一直在“emppic”vb.net附近出现这个错误“无效语法”
EN

Stack Overflow用户
提问于 2022-04-22 15:47:20
回答 1查看 55关注 0票数 0

我一直在努力将映像保存到我的sql数据库中,但没有效果。我一直有相同的错误‘无效语法附近@emppic’。

我是vb.net新手,我试着删除@emppic,但我得到了相同的错误,只是换了一行。

以下是代码:

代码语言:javascript
运行
复制
    Try
    
        Dim mstream As New System.IO.MemoryStream
        PictureBox4.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
        arrimage = mstream.GetBuffer()
        Dim filesize As UInt32
        filesize = mstream.Length
    
        mstream.Close()
        conn.ConnectionString = Str()
        conn.Open()
        Sql = "INSERT INTO  ADDEMPLOYEE(EMPLOYEEID,FNAME,MNAME,LNAME,SEX, AGE, ADDRESS, BDAY, CONTACT,HEIGHT,WEIGHT,CITIZENSHIP,HIREDDATE, CIVILSTATUS,POSITION,USERNAME,PASSWORD,PAIDLEAVES,UNPAIDLEAVES,SSS,TIN,PHILHEALTH,PAGIBIG,EMPPIC) VALUES(@EMPLOYEEID, @FNAME, @MNAME, @LNAME,@SEX, @AGE, @ADDRESS, @BDAY, @CONTACT, @HEIGHT,@WEIGHT,@CITIZENSHIP,@HIREDDATE, @CIVILSTATUS,@POSITION,@USERNAME,@PASSWORD,@PAIDLEAVES,@UNPAIDLEAVES,@SSS,@TIN,@PHILHEALTH,@PAGIBIG, @EMPPIC"
        cmd.Connection = conn
        cmd.CommandText = Sql
    
        cmd.Parameters.AddWithValue("@EMPLOYEEID", AE_EID.Text)
        cmd.Parameters.AddWithValue("@FNAME", AE_FNAME.Text)
        cmd.Parameters.AddWithValue("@MNAME", AE_MIDNAME.Text)
        cmd.Parameters.AddWithValue("@LNAME", AE_LASTNAME.Text)
        cmd.Parameters.AddWithValue("@SEX", AE_SEX.Text)
        cmd.Parameters.AddWithValue("@AGE", AE_AGE.Text)
        cmd.Parameters.AddWithValue("@ADDRESS", AE_ADDRESS.Text)
        cmd.Parameters.AddWithValue("@BDAY", AE_BDAY.Text)
        cmd.Parameters.AddWithValue("@CONTACT", AE_CONTACT.Text)
        cmd.Parameters.AddWithValue("@HEIGHT", AE_HEIGHT.Text)
        cmd.Parameters.AddWithValue("@WEIGHT", AE_WEIGHT.Text)
        cmd.Parameters.AddWithValue("@CITIZENSHIP", AE_CITI.Text)
        cmd.Parameters.AddWithValue("@HIREDDATE", AE_HIREDATE.Text)
        cmd.Parameters.AddWithValue("@CIVILSTATUS", AE_CS.Text)
        cmd.Parameters.AddWithValue("@POSITION", AE_POSITION.Text)
        cmd.Parameters.AddWithValue("@USERNAME", AE_USERNAME.Text)
        cmd.Parameters.AddWithValue("@PASSWORD", AE_PASSWORD.Text)
        cmd.Parameters.AddWithValue("@PAIDLEAVES", AE_PL.Text)
        cmd.Parameters.AddWithValue("@UNPAIDLEAVES", AE_UPL.Text)
        cmd.Parameters.AddWithValue("@SSS", AE_SSS.Text)
        cmd.Parameters.AddWithValue("@TIN", AE_TIN.Text)
        cmd.Parameters.AddWithValue("@PHILHEALTH", AE_PHIL.Text)
        cmd.Parameters.AddWithValue("@PAGIBIG", AE_PAGIBIG.Text)
        cmd.Parameters.AddWithValue("@EMPPIC", arrimage)
    
        Dim r As Integer
        r = cmd.ExecuteNonQuery()
        If r > 0 Then
            MsgBox("successfully added")
        Else
            MsgBox("fail to save")
        End If
        cmd.Parameters.Clear()
        conn.Close()
    
    
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try
EN

Stack Overflow用户

发布于 2022-04-22 17:48:37

您希望关闭(插入的)值。一定是“插入()值()”

代码语言:javascript
运行
复制
Sql = "INSERT INTO  ADDEMPLOYEE(EMPLOYEEID,FNAME,MNAME,LNAME,SEX, AGE, ADDRESS, BDAY, CONTACT,HEIGHT,WEIGHT,CITIZENSHIP,HIREDDATE, CIVILSTATUS,POSITION,USERNAME,PASSWORD,PAIDLEAVES,UNPAIDLEAVES,SSS,TIN,PHILHEALTH,PAGIBIG,EMPPIC) VALUES(@EMPLOYEEID, @FNAME, @MNAME, @LNAME,@SEX, @AGE, @ADDRESS, @BDAY, @CONTACT, @HEIGHT,@WEIGHT,@CITIZENSHIP,@HIREDDATE, @CIVILSTATUS,@POSITION,@USERNAME,@PASSWORD,@PAIDLEAVES,@UNPAIDLEAVES,@SSS,@TIN,@PHILHEALTH,@PAGIBIG, @EMPPIC)"
票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71971418

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档