日期:2014-05-17  浏览次数:20379 次

着急,操作数据库为啥老提示这个问题!
VB.NET code

        Dim conn As SqlConnection
        Dim cmd As SqlCommand
        Dim cmdstring As String = "Insert Order (Name,Goods,_End,_Start,Number,Volume,BoxClass,Tel1,Tel2,Email,Company,Time) values('" & TextBox14.Text.ToString & "','" & TextBox18.Text.ToString & "','" & TextBox12.Text.ToString & "','" & TextBox11.Text.ToString & "','" & TextBox19.Text.ToString & "','" & TextBox8.Text.ToString & "','" & DropDownList3.SelectedValue.ToString & "','" & TextBox15.Text.ToString & "','" & TextBox17.Text.ToString & "','" & TextBox16.Text.ToString & "','" & TextBox13.Text.ToString & "','" & TextBox9.Text.ToString & "')"
        conn = New SqlConnection("Data source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
        cmd = New SqlCommand(cmdstring, conn)
        conn.Open()

        cmd.ExecuteNonQuery()
        conn.Close()



insert后面的引号有问题,帮忙下,谢谢!

------解决方案--------------------
加个断点看得到的sql是什么,在到查询分析器里运行下。

你这里面有数字字段,数字是不用加引号的。。