我在我的应用程序中添加了一个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仅用于测试。一旦它正常工作,它们将被用户输入替换。
答案 0 :(得分:5)
似乎是Visual Studio 2012的known problem。重新启动应该有助于删除这些消息。
答案 1 :(得分: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