MySqlDependency with Parameterized Query
Posted: Fri 05 Jun 2020 09:52
Hey
Using the .Net Core Version of your mySQL Product
I maybe found a bug in the MySqlDependency class
I want to add a CommandDependency by using a list, what works really fine:
The problem with this code is, that Visual Studio says, that the Select command is not safe: https://docs.microsoft.com/en-us/visual ... ew=vs-2019
This is, why I tried to add parameterized Query to the CommandDependency:
But then, then OnChange event get's never hit. In the first solution, everything works fine.
Could you please check this
THX a lot
Using the .Net Core Version of your mySQL Product
I maybe found a bug in the MySqlDependency class
I want to add a CommandDependency by using a list, what works really fine:
Code: Select all
locListOfTables.ForEach(Sub(locItem)
Dim locCommand As New MySqlCommand With {.Connection = myConnection,
.CommandText = String.Format("Select * from {0}", locItem}
Dim locTableCommand = locCommand
locDependency.AddCommandDependency(locTableCommand)
End Sub)
This is, why I tried to add parameterized Query to the CommandDependency:
Code: Select all
locListOfTables.ForEach(Sub(locItem)
Dim locCommand As New MySqlCommand With {.Connection = myConnection,
.CommandText = "Select * from :table"}
locCommand.Parameters.Add("table", locItem.ToString)
Dim locTableCommand = locCommand
locDependency.AddCommandDependency(locTableCommand)
End Sub)
Could you please check this
THX a lot