标签 'N' 已经声明。标签名称在查询批处理或存储过程中必须是唯一的
The label 'N' has already been declared. Label names must be unique within a query batch or stored procedure
我有一个问题。
我需要在 vb.net 中制作一个需要在 sql 数据库中设置文本的程序。
但每次当我点击导出到数据库时,程序都会关闭并显示:
The label 'N' has already been declared. Label names must be unique
within a query batch or stored procedure
我不知道这是什么意思,我是 .net 语言的新手。希望有人能帮助我。
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\klaasjelle\documents\visual studio 2017\Projects\Opdracht\Opdracht\Opdracht1.mdf;Integrated Security=True"
con.Open()
cmd.Connection = con
cmd.CommandText = $"INSERT INTO opdracht ('FilePath', 'ImageSide', 'ImageSize') VALUES ('{TextBox1.Text}')"
cmd.ExecuteNonQuery()
End Sub
我想你没有有效的命令文本。
cmd.CommandText = "INSERT INTO opdracht (FilePath, ImageSide, ImageSize) VALUES ('"
+ TextBox1.Text + "')"
我有一个问题。
我需要在 vb.net 中制作一个需要在 sql 数据库中设置文本的程序。 但每次当我点击导出到数据库时,程序都会关闭并显示:
The label 'N' has already been declared. Label names must be unique within a query batch or stored procedure
我不知道这是什么意思,我是 .net 语言的新手。希望有人能帮助我。
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim con As New SqlConnection
Dim cmd As New SqlCommand
con.ConnectionString = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\klaasjelle\documents\visual studio 2017\Projects\Opdracht\Opdracht\Opdracht1.mdf;Integrated Security=True"
con.Open()
cmd.Connection = con
cmd.CommandText = $"INSERT INTO opdracht ('FilePath', 'ImageSide', 'ImageSize') VALUES ('{TextBox1.Text}')"
cmd.ExecuteNonQuery()
End Sub
我想你没有有效的命令文本。
cmd.CommandText = "INSERT INTO opdracht (FilePath, ImageSide, ImageSize) VALUES ('"
+ TextBox1.Text + "')"