我在我的应用程序中添加了一个 UPDATE 语句,它工作正常。它正确更新了数据库,除了四个错误消息之外,我没有看到任何问题。这是什么意思?
Error 1 Type Microsoft.Data.Tools.Schema.Sql.Sql90DatabaseSchemaProvider, Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not a valid extension type. 0 0
Error 2 Type Microsoft.Data.Tools.Schema.Sql.Sql100DatabaseSchemaProvider, Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not a valid extension type. 0 0
Error 3 Type Microsoft.Data.Tools.Schema.Sql.Sql110DatabaseSchemaProvider, Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not a valid extension type. 0 0
Error 4 Type Microsoft.Data.Tools.Schema.Sql.SqlAzureDatabaseSchemaProvider, Microsoft.Data.Tools.Schema.Sql, Version=10.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a is not a valid extension type. 0 0
我的代码:
Using sqlCon = New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ITCSDatabase.mdf;Integrated Security=True")
sqlCon.Open()
Dim name As String = "Name"
Dim link As String = "link"
Dim dec As Integer = 0
Dim sqlUpdate = "INSERT INTO appTable " & _
"VALUES (41, @name, @link, 0, @dec, 0)"
Dim updateCmd = New SqlCommand(sqlUpdate, sqlCon)
updateCmd.Parameters.AddWithValue("@name", Name)
updateCmd.Parameters.AddWithValue("@link", link)
updateCmd.Parameters.AddWithValue("@dec", dec)
updateCmd.ExecuteNonQuery()
sqlCon.Close()
End Using
*注意:它是本地存储在用户机器上的本地数据库 (.mdf)。**局部变量;name、link 和 dec 仅用于测试。一旦它正常工作,它们将被用户输入替换。