“都必须不是有效的扩展类型。“错误?

时间:2021-06-08 16:31:28

I added an UPDATE statement to my application which works fine. It updates the database correctly and other than the four error messages, I am seeing no problems. What does this mean?

我在我的应用程序中添加了一条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

My code:

我的代码:

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

*Note: it is a Local Database (.mdf) stored locally on the user's machine. **The local variables; name, link and dec are just for testing. Once it works correctly, they will be replaced by user input.

*注意:这是一个本地数据库(.mdf),存储在用户机器上。* *局部变量;名称、链接和dec仅用于测试。一旦它正确工作,它们将被用户输入所取代。

2 个解决方案

#1


5  

Seems to be a known problem of VisualStudio 2012. Restarting should help to remove these messages.

好像是2012 VisualStudio的一个已知问题。重新启动应该有助于删除这些消息。

#2


0  

Try this:

试试这个:

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

#1


5  

Seems to be a known problem of VisualStudio 2012. Restarting should help to remove these messages.

好像是2012 VisualStudio的一个已知问题。重新启动应该有助于删除这些消息。

#2


0  

Try this:

试试这个:

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