Syntax error in INSERT INTO Statement when writing to Access

断了今生、忘了曾经 提交于 2019-12-02 10:24:51

I suspect you just need to use named parameters instead of positional ones:

INSERT INTO FirstLast (First, Last) VALUES (@First, @Last)

Note that you should also use Using statements for the connection and command, so that you clean up after yourself automatically without needing an explicit Finally block. (You can get rid of your entire Try/Catch/Finally given that you're just rethrowing the exception anyway.)

As noted in the comment below, you also probably meant to use TextBox2.Text for the @Last parameter, rather than using TextBox1.Text again.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!